11#import <Foundation/Foundation.h>
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]) {
71static bool find_attribute(
const std::string &attributes,
const char *search_attribute)
74 const char *end = attributes.data() + attributes.size();
75 for (
const char *item = attributes.data(); item < end; item += strlen(item) + 1) {
76 if (
STREQ(item, search_attribute)) {
97 ssize_t size = listxattr(path,
nullptr, 0, XATTR_NOFOLLOW);
102 std::string attributes(size,
'\0');
103 size = listxattr(path, attributes.data(), size, XATTR_NOFOLLOW);
132 NSURL *fileURL = [[[NSURL alloc] initFileURLWithFileSystemRepresentation:path
134 relativeToURL:nil] autorelease];
138 NSArray *resourceKeys =
nullptr;
142 resourceKeys = @[ NSURLIsSymbolicLinkKey, NSURLIsAliasFileKey, NSURLIsHiddenKey ];
146 NSURLIsSymbolicLinkKey,
154 NSDictionary *resourceKeyValues = [fileURL resourceValuesForKeys:resourceKeys error:nil];
156 const bool is_symlink = [resourceKeyValues[NSURLIsSymbolicLinkKey] boolValue];
157 const bool is_alias = [resourceKeyValues[NSURLIsAliasFileKey] boolValue] && !is_symlink;
158 const bool is_hidden = [resourceKeyValues[NSURLIsHiddenKey] boolValue];
159 const bool is_readable = is_offline || [resourceKeyValues[NSURLIsReadableKey] boolValue];
160 const bool is_writable = is_offline || [resourceKeyValues[NSURLIsWritableKey] boolValue];
171 if (is_readable && !is_writable) {
190 NSString *path = [[NSFileManager defaultManager] currentDirectoryPath];
192 [path getCString:path_expanded maxLength:
length encoding:NSUTF8StringEncoding];
201 NSString *path = [[NSString alloc] initWithUTF8String:dir];
202 if ([[NSFileManager defaultManager] changeCurrentDirectoryPath:path] == YES) {
File and directory operations.
SIMD_FORCE_INLINE btScalar length() const
Return the length of the vector.
CCL_NAMESPACE_BEGIN struct Options options
bool BLI_change_working_dir(const char *dir)
static bool test_file_is_offline(const char *path)
eFileAttributes BLI_file_attributes(const char *path)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
static const char * ONEDRIVE_RECALLONOPEN_ATTRIBUTE
static bool find_attribute(const std::string &attributes, const char *search_attribute)
static bool test_onedrive_file_is_placeholder(const char *path)
bool BLI_file_alias_target(const char *filepath, char r_targetpath[768]) ATTR_WARN_UNUSED_RESULT
char * BLI_current_working_dir(char *dir, size_t maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()