mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-02-13 07:31:04 +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;
|
return chdir(path) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_OpenShellFolder(const char* folder)
|
void I_OpenShellFolder(const char* infolder)
|
||||||
{
|
{
|
||||||
char curdir[PATH_MAX];
|
char* curdir = get_current_dir_name();
|
||||||
if (!getcwd (curdir, countof(curdir)))
|
|
||||||
{
|
|
||||||
Printf ("Current path too long\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
chdir(folder);
|
if (!chdir(infolder))
|
||||||
Printf("Opening folder: %s\n", folder);
|
{
|
||||||
std::system("open .");
|
Printf("Opening folder: %s\n", infolder);
|
||||||
chdir(curdir);
|
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;
|
return seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I_OpenShellFolder(const char* folder)
|
void I_OpenShellFolder(const char* infolder)
|
||||||
{
|
{
|
||||||
char curdir[PATH_MAX];
|
char* curdir = get_current_dir_name();
|
||||||
if (!getcwd (curdir, countof(curdir)))
|
|
||||||
{
|
|
||||||
Printf ("Current path too long\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
chdir(folder);
|
if (!chdir(infolder))
|
||||||
Printf("Opening folder: %s\n", folder);
|
{
|
||||||
std::system("xdg-open .");
|
Printf("Opening folder: %s\n", infolder);
|
||||||
chdir(curdir);
|
system("xdg-open .");
|
||||||
|
chdir(curdir);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Printf("Unable to open directory '%s\n", infolder);
|
||||||
|
}
|
||||||
|
free(curdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue