head 1.1; access; symbols pkgsrc-2026Q1:1.1.0.46 pkgsrc-2026Q1-base:1.1 pkgsrc-2025Q4:1.1.0.44 pkgsrc-2025Q4-base:1.1 pkgsrc-2025Q3:1.1.0.42 pkgsrc-2025Q3-base:1.1 pkgsrc-2025Q2:1.1.0.40 pkgsrc-2025Q2-base:1.1 pkgsrc-2025Q1:1.1.0.38 pkgsrc-2025Q1-base:1.1 pkgsrc-2024Q4:1.1.0.36 pkgsrc-2024Q4-base:1.1 pkgsrc-2024Q3:1.1.0.34 pkgsrc-2024Q3-base:1.1 pkgsrc-2024Q2:1.1.0.32 pkgsrc-2024Q2-base:1.1 pkgsrc-2024Q1:1.1.0.30 pkgsrc-2024Q1-base:1.1 pkgsrc-2023Q4:1.1.0.28 pkgsrc-2023Q4-base:1.1 pkgsrc-2023Q3:1.1.0.26 pkgsrc-2023Q3-base:1.1 pkgsrc-2023Q2:1.1.0.24 pkgsrc-2023Q2-base:1.1 pkgsrc-2023Q1:1.1.0.22 pkgsrc-2023Q1-base:1.1 pkgsrc-2022Q4:1.1.0.20 pkgsrc-2022Q4-base:1.1 pkgsrc-2022Q3:1.1.0.18 pkgsrc-2022Q3-base:1.1 pkgsrc-2022Q2:1.1.0.16 pkgsrc-2022Q2-base:1.1 pkgsrc-2022Q1:1.1.0.14 pkgsrc-2022Q1-base:1.1 pkgsrc-2021Q4:1.1.0.12 pkgsrc-2021Q4-base:1.1 pkgsrc-2021Q3:1.1.0.10 pkgsrc-2021Q3-base:1.1 pkgsrc-2021Q2:1.1.0.8 pkgsrc-2021Q2-base:1.1 pkgsrc-2021Q1:1.1.0.6 pkgsrc-2021Q1-base:1.1 pkgsrc-2020Q4:1.1.0.4 pkgsrc-2020Q4-base:1.1 pkgsrc-2020Q3:1.1.0.2 pkgsrc-2020Q3-base:1.1; locks; strict; comment @// @; 1.1 date 2020.07.26.05.21.20; author dholland; state Exp; branches; next ; commitid vx8kfVk8fqE56yhC; desc @@ 1.1 log @Add Endless Sky, a side-scrolling space trading game. (Its ancestry clearly includes Elite, though I couldn't say how in any detail.) Alas, it does not run on my NetBSD because of opengl version issues, but it should run on Linux and MacOS. Be careful, it can be quite a timesuck :-) @ text @$NetBSD$ Fix the logic for finding the game data. --- source/Files.cpp~ 2020-05-01 19:02:38.000000000 +0000 +++ source/Files.cpp @@@@ -102,20 +102,32 @@@@ void Files::Init(const char * const *arg // Find the path to the resource directory. This will depend on the // operating system, and can be overridden by a command line argument. char *str = SDL_GetBasePath(); - if(!str) - throw runtime_error("Unable to get path to resource directory!"); - - resources = str; - SDL_free(str); + if(str) + { + resources = str; + SDL_free(str); + } + else + { +#ifdef BINDIR + // SDL_GetBasePath fails on some systems if e.g. /proc isn't mounted. + // Compile in the installation path as a fallback. + resources = BINDIR "/"; +#else + throw runtime_error("Unable to get path to resource directory! (use -r)"); +#endif + } } #if defined _WIN32 FixWindowsSlashes(resources); #endif if(resources.back() != '/') resources += '/'; -#if defined __linux__ || defined __FreeBSD__ || defined __DragonFly__ +#if defined __linux__ || defined __FreeBSD__ || defined __DragonFly__ || defined __NetBSD__ || defined __OpenBSD__ // Special case, for Linux: the resource files are not in the same place as // the executable, but are under the same prefix (/usr or /usr/local). + // ...or /usr/pkg or /usr/contrib or /opt or... +#if 0 static const string LOCAL_PATH = "/usr/local/"; static const string STANDARD_PATH = "/usr/"; static const string RESOURCE_PATH = "share/games/endless-sky/"; @@@@ -123,6 +135,10 @@@@ void Files::Init(const char * const *arg resources = LOCAL_PATH + RESOURCE_PATH; else if(!resources.compare(0, STANDARD_PATH.length(), STANDARD_PATH)) resources = STANDARD_PATH + RESOURCE_PATH; +#else + static const string RESOURCE_PATH = "share/games/endless-sky/"; + resources = resources + "../" + RESOURCE_PATH; +#endif /* 0 */ #elif defined __APPLE__ // Special case for Mac OS X: the resources are in ../Resources relative to // the folder the binary is in. @