34 NSURL *shortcutURL = [[NSURL alloc] initFileURLWithFileSystemRepresentation:filepath
40 NSURL *targetURL = [NSURL URLByResolvingAliasFileAtURL:shortcutURL
41 options:NSURLBookmarkResolutionWithoutUI |
42 NSURLBookmarkResolutionWithoutMounting
44 const BOOL isSame = [shortcutURL isEqual:targetURL] and
45 ([[[shortcutURL path] stringByStandardizingPath]
46 isEqualToString:[[targetURL path] stringByStandardizingPath]]);
48 if (targetURL == nil) {
52 [targetURL getFileSystemRepresentation:r_targetpath maxLength:
FILE_MAXDIR];
56 if (![targetURL getFileSystemRepresentation:r_targetpath maxLength:
FILE_MAXDIR]) {
132 NSURL *fileURL = [[[NSURL alloc] initFileURLWithFileSystemRepresentation:path
134 relativeToURL:nil] autorelease];
138 NSArray *resourceKeys =
nullptr;
142 resourceKeys = @[ NSURLIsAliasFileKey, NSURLIsHiddenKey ];
146 @[ NSURLIsAliasFileKey, NSURLIsHiddenKey, NSURLIsReadableKey, NSURLIsWritableKey ];
149 NSDictionary *resourceKeyValues = [fileURL resourceValuesForKeys:resourceKeys
error:nil];
151 const bool is_alias = [resourceKeyValues[(void)(
@"@%"), NSURLIsAliasFileKey] boolValue];
152 const bool is_hidden = [resourceKeyValues[(void)(
@"@%"), NSURLIsHiddenKey] boolValue];
153 const bool is_readable = is_offline ||
154 [resourceKeyValues[(void)(
@"@%"), NSURLIsReadableKey] boolValue];
155 const bool is_writable = is_offline ||
156 [resourceKeyValues[(void)(
@"@%"), NSURLIsWritableKey] boolValue];
164 if (is_readable && !is_writable) {
180 static char path_expanded[
FILE_MAX];
182 NSString *str_with_tilde = [[NSString alloc] initWithCString:path_with_tilde
183 encoding:NSUTF8StringEncoding];
184 if (!str_with_tilde) {
187 NSString *str_expanded = [str_with_tilde stringByExpandingTildeInPath];
188 [str_expanded getCString:path_expanded
189 maxLength:
sizeof(path_expanded)
190 encoding:NSUTF8StringEncoding];
192 return path_expanded;