mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-07 17:11:17 +00:00
- use NSFileManager on macOS to handle the current directory.
This commit is contained in:
parent
532a493752
commit
03c725c0da
1 changed files with 7 additions and 15 deletions
|
@ -173,31 +173,23 @@ unsigned int I_MakeRNGSeed()
|
||||||
|
|
||||||
FString I_GetCWD()
|
FString I_GetCWD()
|
||||||
{
|
{
|
||||||
char curdir[PATH_MAX];
|
NSString *currentpath = [[NSFileManager defaultManager] currentDirectoryPath];
|
||||||
if (!getcwd(curdir, countof(curdir)))
|
return currentpath.UTF8String;
|
||||||
{
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
return curdir;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool I_ChDir(const char* path)
|
bool I_ChDir(const char* path)
|
||||||
{
|
{
|
||||||
return chdir(path) == 0;
|
return [[NSFileManager defaultManager] changeCurrentDirectoryPath:[NSString stringWithUTF8String:path]];
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_OpenShellFolder(const char* folder)
|
void I_OpenShellFolder(const char* folder)
|
||||||
{
|
{
|
||||||
char curdir[PATH_MAX];
|
NSFileManager *filemgr = [NSFileManager defaultManager];
|
||||||
if (!getcwd (curdir, countof(curdir)))
|
NSString *currentpath = [filemgr currentDirectoryPath];
|
||||||
{
|
|
||||||
Printf ("Current path too long\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
chdir(folder);
|
[filemgr changeCurrentDirectoryPath:[NSString stringWithUTF8String:folder]];
|
||||||
Printf("Opening folder: %s\n", folder);
|
Printf("Opening folder: %s\n", folder);
|
||||||
std::system("open .");
|
std::system("open .");
|
||||||
chdir(curdir);
|
[filemgr changeCurrentDirectoryPath:currentpath];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue