According to the doc, the paths returned by NSDirectoryEnumerator
should be relative to the folder which is enumerated:
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.
But, when I do
NSDirectoryEnumerator *dirEnum = [myFileManager enumeratorAtURL:URLFolder
includingPropertiesForKeys:nil
options:NSDirectoryEnumerationSkipsHiddenFiles
errorHandler:^BOOL(NSURL *url, NSError *error) {
return YES ;}];
I get paths which are absolute!
Is it normal or a known problem?
The function enumeratorAtURL:includingPropertiesForKeys:options:errorHandler: is actually supposed to return absolute paths (see the discussion in the link). If you want relative path values, you can use enumeratorAtPath:.