10 #import <Foundation/Foundation.h>
12 #include <sys/xattr.h>
32 NSURL *shortcutURL = [[NSURL alloc] initFileURLWithFileSystemRepresentation:filepath
35 const NSURL *targetURL = [NSURL URLByResolvingAliasFileAtURL:shortcutURL
36 options:NSURLBookmarkResolutionWithoutUI
38 const BOOL isSame = [shortcutURL isEqual:targetURL] and
39 ([[[shortcutURL path] stringByStandardizingPath]
40 isEqualToString:[[targetURL path] stringByStandardizingPath]]);
42 if (targetURL == nil) {
46 [targetURL getFileSystemRepresentation:r_targetpath maxLength:
FILE_MAXDIR];
50 if (![targetURL getFileSystemRepresentation:r_targetpath maxLength:
FILE_MAXDIR]) {
65 static bool find_attribute(
const std::string &attributes,
const char *search_attribute)
68 const char *end = attributes.data() + attributes.size();
69 for (
const char *item = attributes.data(); item < end; item += strlen(item) + 1) {
70 if (
STREQ(item, search_attribute)) {
91 ssize_t size = listxattr(path,
nullptr, 0, XATTR_NOFOLLOW);
96 std::string attributes(
size,
'\0');
97 size = listxattr(path, attributes.data(),
size, XATTR_NOFOLLOW);
126 const NSURL *fileURL = [[NSURL alloc] initFileURLWithFileSystemRepresentation:path
132 NSArray *resourceKeys =
nullptr;
136 resourceKeys = @[ NSURLIsAliasFileKey, NSURLIsHiddenKey ];
140 @[ NSURLIsAliasFileKey, NSURLIsHiddenKey, NSURLIsReadableKey, NSURLIsWritableKey ];
143 const NSDictionary *resourceKeyValues = [fileURL resourceValuesForKeys:resourceKeys
error:nil];
145 const bool is_alias = [resourceKeyValues[(
void)(
@"@%"), NSURLIsAliasFileKey] boolValue];
146 const bool is_hidden = [resourceKeyValues[(
void)(
@"@%"), NSURLIsHiddenKey] boolValue];
147 const bool is_readable = is_offline ||
148 [resourceKeyValues[(
void)(
@"@%"), NSURLIsReadableKey] boolValue];
149 const bool is_writable = is_offline ||
150 [resourceKeyValues[(
void)(
@"@%"), NSURLIsWritableKey] boolValue];
158 if (is_readable && !is_writable) {
174 static char path_expanded[
FILE_MAX];
176 const NSString *
const str_with_tilde = [[NSString alloc] initWithCString:path_with_tilde
177 encoding:NSUTF8StringEncoding];
178 if (!str_with_tilde) {
181 const NSString *
const str_expanded = [str_with_tilde stringByExpandingTildeInPath];
182 [str_expanded getCString:path_expanded
183 maxLength:
sizeof(path_expanded)
184 encoding:NSUTF8StringEncoding];
186 return path_expanded;
File and directory operations.
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
CCL_NAMESPACE_BEGIN struct Options options
SyclQueue void void size_t num_bytes void
static void error(const char *str)
eFileAttributes BLI_file_attributes(const char *path)
static const char * ONEDRIVE_RECALLONOPEN_ATTRIBUTE
bool BLI_file_alias_target(const char *filepath, char r_targetpath[FILE_MAXDIR])
static bool test_onedrive_file_is_placeholder(const char *path)
static bool test_file_is_offline(const char *path)
const char * BLI_expand_tilde(const char *path_with_tilde)
static bool find_attribute(const std::string &attributes, const char *search_attribute)