forked from blender/blender
Removed _apple_ functions and replaced with #if guards for CWD utility helpers #1
@ -1 +1 @@
|
||||
Subproject commit 08b372721b9b33a16f380cab23b2e5ded738ea96
|
||||
Subproject commit 4331c8e76c2f42b9fd903716c333d6cdeaa5cebd
|
@ -1 +1 @@
|
||||
Subproject commit d887a4ea6b2a9d64b926034d4e78ecf7a48ca979
|
||||
Subproject commit 48320b2d9f3d829c46ae4a6a6aab0bd94e80c830
|
@ -1 +1 @@
|
||||
Subproject commit 9d538629bb8a425991c7d10a49bab1ba0788c18f
|
||||
Subproject commit 14ab9273409ea0231d08ba6e86fdc73d4e459e99
|
@ -325,8 +325,6 @@ void BLI_file_free_lines(struct LinkNode *lines);
|
||||
* Giving a path without leading `~` is not an error.
|
||||
*/
|
||||
const char *BLI_expand_tilde(const char *path_with_tilde);
|
||||
const char *BLI_apple_getcwd(const size_t max_length);
|
||||
int BLI_apple_chdir(const char *dir);
|
||||
#endif
|
||||
/* This weirdo pops up in two places. */
|
||||
#if !defined(WIN32)
|
||||
|
@ -57,6 +57,7 @@
|
||||
#include "BLI_threads.h"
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#if !defined (__APPLE__)
|
||||
bool BLI_change_working_dir(const char *dir)
|
||||
{
|
||||
BLI_assert(BLI_thread_is_main());
|
||||
@ -70,8 +71,6 @@ bool BLI_change_working_dir(const char *dir)
|
||||
return false;
|
||||
}
|
||||
return _wchdir(wdir) == 0;
|
||||
#elif defined(__APPLE__)
|
||||
return BLI_apple_chdir(dir) == 0;
|
||||
#else
|
||||
int result = chdir(dir);
|
||||
if (result == 0) {
|
||||
@ -91,9 +90,6 @@ char *BLI_current_working_dir(char *dir, const size_t maxncpy)
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
#elif defined(__APPLE__)
|
||||
BLI_strncpy(dir, BLI_apple_getcwd(maxncpy), maxncpy);
|
||||
return dir;
|
||||
#else
|
||||
const char *pwd = BLI_getenv("PWD");
|
||||
if (pwd) {
|
||||
@ -107,6 +103,7 @@ char *BLI_current_working_dir(char *dir, const size_t maxncpy)
|
||||
return getcwd(dir, maxncpy);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
double BLI_dir_free_space(const char *dir)
|
||||
{
|
||||
|
@ -13,6 +13,8 @@
|
||||
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_path_util.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
|
||||
/* Extended file attribute used by OneDrive to mark placeholder files. */
|
||||
static const char *ONEDRIVE_RECALLONOPEN_ATTRIBUTE = "com.microsoft.OneDrive.RecallOnOpen";
|
||||
@ -186,26 +188,26 @@ const char *BLI_expand_tilde(const char *path_with_tilde)
|
||||
return path_expanded;
|
||||
}
|
||||
|
||||
|
||||
const char *BLI_apple_getcwd(const size_t max_length) {
|
||||
char *BLI_current_working_dir(char *dir, const size_t maxncpy) {
|
||||
/* Can't just copy to the *dir pointer, as [path getCString gets grumpy.*/
|
||||
static char path_expanded[PATH_MAX];
|
||||
@autoreleasepool {
|
||||
NSString *path = [[NSFileManager defaultManager] currentDirectoryPath];
|
||||
const size_t length = max_length > PATH_MAX ? PATH_MAX : max_length;
|
||||
const size_t length = maxncpy > PATH_MAX ? PATH_MAX : maxncpy;
|
||||
[path getCString:path_expanded maxLength:length encoding:NSUTF8StringEncoding];
|
||||
BLI_strncpy(dir, path_expanded, maxncpy);
|
||||
return path_expanded;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int BLI_apple_chdir(const char* dir) {
|
||||
bool BLI_change_working_dir(const char* dir) {
|
||||
@autoreleasepool {
|
||||
NSString* path = [[NSString alloc] initWithUTF8String: dir];
|
||||
if ([[NSFileManager defaultManager] changeCurrentDirectoryPath: path] == YES) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 3582f5326d08ca05c2a19056597e49ec5511d854
|
||||
Subproject commit e133fc08cd3254bb3d3bd1345028c8486700bca4
|
Loading…
Reference in New Issue
Block a user