2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 19:44:55 +00:00

Updates to support VISI generation

This commit is contained in:
Jack Andersen
2017-02-23 22:27:07 -10:00
parent 9cf2aec5c1
commit 8c3a7da616
10 changed files with 295 additions and 10 deletions

View File

@@ -744,4 +744,37 @@ int RecursiveMakeDir(const SystemChar* dir) {
}
#endif
const SystemChar* GetTmpDir()
{
#ifdef _WIN32
wchar_t* TMPDIR = _wgetenv(L"TEMP");
if (!TMPDIR)
TMPDIR = (wchar_t*)L"\\Temp";
#else
char* TMPDIR = getenv("TMPDIR");
if (!TMPDIR)
TMPDIR = (char*)"/tmp";
#endif
return TMPDIR;
}
int RunProcess(const SystemChar* path, const SystemChar* const args[])
{
#ifdef _WIN32
#else
pid_t pid = fork();
if (!pid)
{
execvp(path, (char * const *)args);
exit(1);
}
int ret;
if (waitpid(pid, &ret, 0) < 0)
return -1;
if (WIFEXITED(ret))
return WEXITSTATUS(ret);
return -1;
#endif
}
}