fix finding runtime files relative to the executable path

This commit is contained in:
Josh Holtrop 2017-01-03 19:01:48 -05:00
parent 4017d8237e
commit 95381faedc
3 changed files with 4 additions and 4 deletions

View File

@ -6,9 +6,9 @@ static const std::initializer_list<const char *> Shader_Extensions = {"", ".glsl
static std::string System_Runtime_Dir; static std::string System_Runtime_Dir;
void Runtime::init(const char * argv_0, const char * appname) void Runtime::init(const char * executable_path, const char * appname)
{ {
System_Runtime_Dir = Path::join(Path::dirname(Path::dirname(argv_0)), "share", appname); System_Runtime_Dir = Path::join(Path::dirname(Path::dirname(executable_path)), "share", appname);
} }
std::string Runtime::find(Type t, const std::string & name) std::string Runtime::find(Type t, const std::string & name)

View File

@ -14,7 +14,7 @@ public:
}; };
static std::string find(Type t, const std::string & name); static std::string find(Type t, const std::string & name);
static void init(const char * argv_0, const char * appname); static void init(const char * executable_path, const char * appname);
protected: protected:
static std::string find_first_under(const std::string & runtime_subpath, static std::string find_first_under(const std::string & runtime_subpath,

View File

@ -11,7 +11,7 @@ int main(int argc, char * argv[])
return 1; return 1;
} }
Runtime::init(argv[0], APPNAME); Runtime::init(System::executable_path().c_str(), APPNAME);
const char * filename = nullptr; const char * filename = nullptr;
if (argc > 1) if (argc > 1)