From eeeb9809f6939fb19684f3714ce9fc456bc4e0e9 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 24 Apr 2004 19:30:49 +0000 Subject: [PATCH] fix path not being found correctly when started from smpackage --- stepmania/src/RageFileManager.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/stepmania/src/RageFileManager.cpp b/stepmania/src/RageFileManager.cpp index 082fa9a178..47eeeb5fdd 100644 --- a/stepmania/src/RageFileManager.cpp +++ b/stepmania/src/RageFileManager.cpp @@ -69,7 +69,17 @@ static CString GetDirOfExecutable( CString argv0 ) #ifdef _XBOX return "D:\\"; #else - CString sPath = argv0; + /* argv[0] can be wrong in most OS's; try to avoid using it. */ + + CString sPath; +#if defined(_WIN32) + char buf[MAX_PATH]; + GetModuleFileName( NULL, buf, sizeof(buf) ); + sPath = buf; +#else + sPath = argv0; +#endif + sPath.Replace( "\\", "/" ); bool IsAbsolutePath = false;