mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
use GetModuleFileName()
This commit is contained in:
parent
67faec5f8d
commit
f96ddb1420
@ -25,6 +25,9 @@
|
|||||||
// Windows requires this for getcwd().
|
// Windows requires this for getcwd().
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#define getcwd _getcwd
|
#define getcwd _getcwd
|
||||||
|
|
||||||
|
// And this is for GetModuleFileName().
|
||||||
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -330,7 +333,17 @@ void ExecutionEnvironment::
|
|||||||
read_args() {
|
read_args() {
|
||||||
#if defined(HAVE_GLOBAL_ARGV)
|
#if defined(HAVE_GLOBAL_ARGV)
|
||||||
int argc = GLOBAL_ARGC;
|
int argc = GLOBAL_ARGC;
|
||||||
if (argc > 0) {
|
|
||||||
|
#ifdef WIN32_VC
|
||||||
|
static const DWORD buffer_size = 1024;
|
||||||
|
char buffer[buffer_size];
|
||||||
|
DWORD size = GetModuleFileName(NULL, buffer, buffer_size);
|
||||||
|
if (size != 0) {
|
||||||
|
_binary_name = Filename::from_os_specific(string(buffer, size));
|
||||||
|
}
|
||||||
|
#endif // WIN32_VC
|
||||||
|
|
||||||
|
if (_binary_name.empty() && argc > 0) {
|
||||||
_binary_name = GLOBAL_ARGV[0];
|
_binary_name = GLOBAL_ARGV[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user