mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +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()
|
||||
{
|
||||
char curdir[PATH_MAX];
|
||||
if (!getcwd(curdir, countof(curdir)))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return curdir;
|
||||
NSString *currentpath = [[NSFileManager defaultManager] currentDirectoryPath];
|
||||
return currentpath.UTF8String;
|
||||
}
|
||||
|
||||
bool I_ChDir(const char* path)
|
||||
{
|
||||
return chdir(path) == 0;
|
||||
return [[NSFileManager defaultManager] changeCurrentDirectoryPath:[NSString stringWithUTF8String:path]];
|
||||
}
|
||||
|
||||
void I_OpenShellFolder(const char* folder)
|
||||
{
|
||||
char curdir[PATH_MAX];
|
||||
if (!getcwd (curdir, countof(curdir)))
|
||||
{
|
||||
Printf ("Current path too long\n");
|
||||
return;
|
||||
}
|
||||
NSFileManager *filemgr = [NSFileManager defaultManager];
|
||||
NSString *currentpath = [filemgr currentDirectoryPath];
|
||||
|
||||
chdir(folder);
|
||||
[filemgr changeCurrentDirectoryPath:[NSString stringWithUTF8String:folder]];
|
||||
Printf("Opening folder: %s\n", folder);
|
||||
std::system("open .");
|
||||
chdir(curdir);
|
||||
[filemgr changeCurrentDirectoryPath:currentpath];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue