gpt4 book ai didi

cocoa-touch - NSDirectoryEnumerator : are the returned path relative?

转载 作者:行者123 更新时间:2023-12-03 16:19:37 33 4
gpt4 key购买 nike

根据docNSDirectoryEnumerator 返回的路径应该相对于枚举的文件夹:

An NSDirectoryEnumerator object enumerates the contents of a directory, returning the pathnames of all files and directories contained within that directory. These pathnames are relative to the directory.

但是,当我这么做的时候

NSDirectoryEnumerator *dirEnum = [myFileManager enumeratorAtURL:URLFolder
includingPropertiesForKeys:nil
options:NSDirectoryEnumerationSkipsHiddenFiles
errorHandler:^BOOL(NSURL *url, NSError *error) {
return YES ;}];

我得到的是绝对路径!

这是正常现象还是已知问题?

最佳答案

函数enumeratorAtURL:includingPropertiesForKeys:options:errorHandler:实际上应该返回绝对路径(请参阅链接中的讨论)。如果需要相对路径值,可以使用 enumeratorAtPath: .

关于cocoa-touch - NSDirectoryEnumerator : are the returned path relative?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20095666/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com