parent
561e50f6c6
commit
c4791ee009
@ -204,10 +204,10 @@ bool BLI_change_working_dir(const char* dir) {
|
||||
@autoreleasepool {
|
||||
NSString* path = [[NSString alloc] initWithUTF8String: dir];
|
||||
if ([[NSFileManager defaultManager] changeCurrentDirectoryPath: path] == YES) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ TEST_F(ChangeWorkingDirectoryTest, change_working_directory)
|
||||
FAIL() << "unable to get the current working directory";
|
||||
}
|
||||
|
||||
const std::string temp_file_name(std::tmpnam(nullptr));
|
||||
std::string temp_file_name(std::tmpnam(nullptr));
|
||||
test_temp_dir = temp_file_name + "_новый";
|
||||
|
||||
if (BLI_exists(test_temp_dir.c_str())) {
|
||||
@ -84,6 +84,13 @@ TEST_F(ChangeWorkingDirectoryTest, change_working_directory)
|
||||
FAIL() << "unable to get the current working directory";
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
/* The name returned by std::tmpnam is fine but the Apple OS method
|
||||
* picks the true var folder, not the alias, meaning the below
|
||||
* comparison always fails unless we prepend with the correct value. */
|
||||
test_temp_dir = "/private" + test_temp_dir;
|
||||
#endif // #ifdef __APPLE__
|
||||
|
||||
ASSERT_EQ(BLI_path_cmp_normalized(cwd, test_temp_dir.c_str()), 0)
|
||||
<< "the path of the current working directory should equal the path of the temporary "
|
||||
"directory that was created.";
|
||||
|
Loading…
Reference in New Issue
Block a user