Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2020-03-26 19:52:41 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-03-26 21:57:30 +0300
commitafb1a64ccb81b7ed792f64151986f40f53af8da5 (patch)
treed7dfdb1f1b8d6dda67c91ea813e09fdbb826b335 /source/blender/blenlib/intern/storage.c
parentd1972e50cbef6e2a40ffc259f10e08493511dc66 (diff)
Fix T60682: adds macOS alias redirection for directories
This adds support for macOS aliases in addition to symlinks. It also adds support for hidden, readonly and system file attributes. Contributed by Ankit (ankitm) with modifications by me. Differential Revision: https://developer.blender.org/D6679
Diffstat (limited to 'source/blender/blenlib/intern/storage.c')
-rw-r--r--source/blender/blenlib/intern/storage.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index da80777e6d6..7274a15661a 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -226,11 +226,12 @@ size_t BLI_file_size(const char *path)
return stats.st_size;
}
+#ifndef __APPLE__
eFileAttributes BLI_file_attributes(const char *path)
{
int ret = 0;
-#ifdef WIN32
+# ifdef WIN32
wchar_t wline[FILE_MAXDIR];
BLI_strncpy_wchar_from_utf8(wline, path, ARRAY_SIZE(wline));
DWORD attr = GetFileAttributesW(wline);
@@ -265,19 +266,9 @@ eFileAttributes BLI_file_attributes(const char *path)
ret |= FILE_ATTR_REPARSE_POINT;
}
-#endif
-
-#ifdef __APPLE__
-
- /* TODO:
- * If Hidden (Invisible) set FILE_ATTR_HIDDEN
- * If Locked set FILE_ATTR_READONLY
- * If Restricted set FILE_ATTR_RESTRICTED
- */
-
-#endif
+# endif
-#ifdef __linux__
+# ifdef __linux__
UNUSED_VARS(path);
/* TODO:
@@ -285,10 +276,23 @@ eFileAttributes BLI_file_attributes(const char *path)
* If Archived set FILE_ATTR_ARCHIVE
*/
-#endif
+# endif
return ret;
}
+#endif
+
+/**
+ * Returns the target path of a file-based redirection, like Mac Alias or Win32 Shortcut file.
+ */
+#ifndef __APPLE__
+bool BLI_file_alias_target(char UNUSED(target[FILE_MAXDIR]), const char *UNUSED(filepath))
+{
+ /* TODO: Find target in Win32 Shortcut - Shell Link (.lnk) file.
+ * Format: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-shllink/ */
+ return false;
+}
+#endif
/**
* Returns the st_mode from stat-ing the specified path name, or 0 if stat fails