Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / games / 0ad / rootdir_env.patch
blob95463c7e2df4667ded4284d7c93215605c87dc3b
1 diff --git a/source/ps/GameSetup/Paths.cpp b/source/ps/GameSetup/Paths.cpp
2 index 474364e..bf084b4 100644
3 --- a/source/ps/GameSetup/Paths.cpp
4 +++ b/source/ps/GameSetup/Paths.cpp
5 @@ -155,32 +155,8 @@ Paths::Paths(const CmdLineArgs& args)
7 /*static*/ OsPath Paths::Root(const OsPath& argv0)
9 -#if OS_ANDROID
10 - return OsPath("/sdcard/0ad"); // TODO: this is kind of bogus
11 -#else
13 - // get full path to executable
14 - OsPath pathname = sys_ExecutablePathname(); // safe, but requires OS-specific implementation
15 - if(pathname.empty()) // failed, use argv[0] instead
16 - {
17 - errno = 0;
18 - pathname = wrealpath(argv0);
19 - if(pathname.empty())
20 - WARN_IF_ERR(StatusFromErrno());
21 - }
23 - // make sure it's valid
24 - if(!FileExists(pathname))
25 - {
26 - LOGERROR("Cannot find executable (expected at '%s')", pathname.string8());
27 - WARN_IF_ERR(StatusFromErrno());
28 - }
30 - for(size_t i = 0; i < 2; i++) // remove "system/name.exe"
31 - pathname = pathname.Parent();
32 - return pathname;
34 -#endif
35 + UNUSED2(argv0);
36 + return OsPath(getenv("ZEROAD_ROOTDIR"));
39 /*static*/ OsPath Paths::RootData(const OsPath& argv0)