URLByResolvingSymlinksInPath
Returns a new URL that points to the same resource as the original URL and includes no symbolic links.
- (NSURL *)URLByResolvingSymlinksInPath
Return Value of [NSURL URLByResolvingSymlinksInPath]
A new URL that points to the same resource as the original URL and includes no symbolic links.
Discussion of [NSURL URLByResolvingSymlinksInPath]
If the original URL has no symbolic links, the returned URL is identical to the original URL.
This method only works on URLs with the
file:
path scheme. This method will return an identical URL for all other URLs.
Example of [NSURL URLByResolvingSymlinksInPath]
NSURL * myURLWithoutSymlinks = [myURLWithSymlinks URLByResolvingSymlinksInPath];
Example of [NSURL URLByResolvingSymlinksInPath]
+ (NSArray *)enumerateContentsOfFolderWithPath:(NSURL *)aFolderPath
{
NSError *error = nil;
NSArray *contentProperties = @[NSURLIsDirectoryKey,
NSURLIsReadableKey,
NSURLCreationDateKey,
NSURLContentAccessDateKey,
NSURLContentModificationDateKey];
NSArray *contents = [[NSFileManager defaultManager] contentsOfDirectoryAtURL:aFolderPath
includingPropertiesForKeys:contentProperties
options:NSDirectoryEnumerationSkipsHiddenFiles
error:&error];
if (error != nil)
DLog(@"Content enumeration error: %@", error);
NSMutableArray *pdfURLs = [NSMutableArray array];
for (NSURL *item in contents)
{
NSURL *fileURL = [NSURL fileURLWithPath: [item path]];
NSURL *noSimlink = [fileURL URLByResolvingSymlinksInPath];
[pdfURLs addObject: noSimlink];
}
return pdfURLs;
}