mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-02-13 07:31:04 +00:00
- get_current_dir_name apparently does not exist on macOS
This commit is contained in:
parent
7f3c09c918
commit
532a493752
1 changed files with 14 additions and 18 deletions
|
@ -173,14 +173,12 @@ unsigned int I_MakeRNGSeed()
|
||||||
|
|
||||||
FString I_GetCWD()
|
FString I_GetCWD()
|
||||||
{
|
{
|
||||||
char* curdir = get_current_dir_name();
|
char curdir[PATH_MAX];
|
||||||
if (!curdir)
|
if (!getcwd(curdir, countof(curdir)))
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
FString ret(curdir);
|
return curdir;
|
||||||
free(curdir);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool I_ChDir(const char* path)
|
bool I_ChDir(const char* path)
|
||||||
|
@ -188,20 +186,18 @@ bool I_ChDir(const char* path)
|
||||||
return chdir(path) == 0;
|
return chdir(path) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_OpenShellFolder(const char* infolder)
|
void I_OpenShellFolder(const char* folder)
|
||||||
{
|
{
|
||||||
char* curdir = get_current_dir_name();
|
char curdir[PATH_MAX];
|
||||||
|
if (!getcwd (curdir, countof(curdir)))
|
||||||
|
{
|
||||||
|
Printf ("Current path too long\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!chdir(infolder))
|
chdir(folder);
|
||||||
{
|
Printf("Opening folder: %s\n", folder);
|
||||||
Printf("Opening folder: %s\n", infolder);
|
std::system("open .");
|
||||||
system("open .");
|
|
||||||
chdir(curdir);
|
chdir(curdir);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Printf("Unable to open directory '%s\n", infolder);
|
|
||||||
}
|
|
||||||
free(curdir);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue