mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Add shell_execute.
This commit is contained in:
parent
cf418160b6
commit
8d7251be4a
|
@ -56,6 +56,7 @@
|
|||
#include <direct.h>
|
||||
#include <errno.h>
|
||||
#include <process.h>
|
||||
#include <shellapi.h>
|
||||
#else
|
||||
#error NOT IMPLEMENTED
|
||||
#endif
|
||||
|
@ -2343,6 +2344,16 @@ int pid()
|
|||
#endif
|
||||
}
|
||||
|
||||
void shell_execute(const char *file, const char *argv)
|
||||
{
|
||||
#if defined(CONF_FAMILY_WINDOWS)
|
||||
ShellExecute(NULL, NULL, file, NULL, NULL, SW_SHOWDEFAULT);
|
||||
#elif defined(CONF_FAMILY_UNIX)
|
||||
pid_t pid = fork();
|
||||
if(!pid)
|
||||
execv(file, argv);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
|
|
@ -1326,6 +1326,8 @@ int str_utf8_check(const char *str);
|
|||
|
||||
int pid();
|
||||
|
||||
void shell_execute(const char *file, const char *argv);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue