mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
- use char* get_current_dir_name() in Mac/Linux to save the cwd in the shell open function
This commit is contained in:
parent
a2369b945c
commit
e261132db0
2 changed files with 26 additions and 22 deletions
|
@ -186,18 +186,20 @@ bool I_ChDir(const char* path)
|
|||
return chdir(path) == 0;
|
||||
}
|
||||
|
||||
void I_OpenShellFolder(const char* folder)
|
||||
void I_OpenShellFolder(const char* infolder)
|
||||
{
|
||||
char curdir[PATH_MAX];
|
||||
if (!getcwd (curdir, countof(curdir)))
|
||||
{
|
||||
Printf ("Current path too long\n");
|
||||
return;
|
||||
}
|
||||
char* curdir = get_current_dir_name();
|
||||
|
||||
chdir(folder);
|
||||
Printf("Opening folder: %s\n", folder);
|
||||
std::system("open .");
|
||||
chdir(curdir);
|
||||
if (!chdir(infolder))
|
||||
{
|
||||
Printf("Opening folder: %s\n", infolder);
|
||||
system("open .");
|
||||
chdir(curdir);
|
||||
}
|
||||
else
|
||||
{
|
||||
Printf("Unable to open directory '%s\n", infolder);
|
||||
}
|
||||
free(curdir);
|
||||
}
|
||||
|
||||
|
|
|
@ -447,18 +447,20 @@ unsigned int I_MakeRNGSeed()
|
|||
return seed;
|
||||
}
|
||||
|
||||
void I_OpenShellFolder(const char* folder)
|
||||
void I_OpenShellFolder(const char* infolder)
|
||||
{
|
||||
char curdir[PATH_MAX];
|
||||
if (!getcwd (curdir, countof(curdir)))
|
||||
{
|
||||
Printf ("Current path too long\n");
|
||||
return;
|
||||
}
|
||||
char* curdir = get_current_dir_name();
|
||||
|
||||
chdir(folder);
|
||||
Printf("Opening folder: %s\n", folder);
|
||||
std::system("xdg-open .");
|
||||
chdir(curdir);
|
||||
if (!chdir(infolder))
|
||||
{
|
||||
Printf("Opening folder: %s\n", infolder);
|
||||
system("xdg-open .");
|
||||
chdir(curdir);
|
||||
}
|
||||
else
|
||||
{
|
||||
Printf("Unable to open directory '%s\n", infolder);
|
||||
}
|
||||
free(curdir);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue