aboutsummaryrefslogtreecommitdiff
path: root/util
Commit message (Expand)AuthorAge
* Don't look for zlib and zstd manually on Windowssfan52021-09-01
* Switch MapBlock compression to zstd (#10788)lhofhansl2021-08-31
* CI: Bump IrrlichtMt to 1.9.0mt3sfan52021-08-31
* Add fwgettext util functionrubenwardy2021-08-19
* Fix GUIEditBoxWithScrollBar using a smaller steps than intlGUIEditBox (#11519)DS2021-08-08
* buildbot: Readd missing IrrlichtMt DLLssfan52021-07-27
* Take advantage of IrrlichtMt CMake target (#11287)JosiahWI2021-07-27
* Buildbot: Use posix on Win64 builds if available (#11355)Juozas2021-06-22
* Move build/android directory to root of project (#11283)NeroBurner2021-06-21
* CI: add workaround to fix clang buildssfan52021-05-17
* Add basic client-server test to CIsfan52021-05-05
* Update library versions in buildbot (#11229)sfan52021-04-27
* Look for PostgreSQL library properly and fix CIsfan52021-04-20
* Buildbot changes to allow out-of-tree builds (#11180)sfan52021-04-11
* Adjust build config for Irrlicht changes (again)sfan52021-03-26
* Clean up cmake DLL installation and other minor thingssfan52021-03-12
* CI: update configurations for Irrlicht forksfan52021-03-09
* buildbot: Drop i586-mingw32msvc, add i686-w64-mingw32-posix detectionsfan52021-03-06
* Translate builtin (#10693)Wuzzy2021-03-05
* Disable clang-format, clean up scriptsrubenwardy2021-03-01
* Add script that sorts contributions for use in creditssfan52021-02-23
* Handle UTF-16 correctly in Wireshark dissectorsfan52021-02-02
* Consistently use "health points" (#10868)Zughy2021-01-27
* Fix Android support in bump_version.sh (#10836)rubenwardy2021-01-20
* CI: fix buildsfan52020-12-23
* Add model[] formspec element (#10320)SmallJoker2020-11-04
* Implement override.txt support for special tiles (#10140)Hugues Ross2020-08-04
* Make util/bump_version.sh work againsfan52020-07-08
* Release test build to Android beta programrubenwardy2020-06-25
* Rename “Minimal development test” to “Development Test” (#9928)Wuzzy2020-05-26
* ci: Update Github Actions workflows (#9774)sfan52020-05-02
* Add MetricsBackend with prometheus counter supportLoic Blot2020-04-29
* Replace travis with github actions (#9641)Loïc Blot2020-04-20
* Update wireshark dissector (#9621)sfan52020-04-14
* Refactor texture overrides and add new features (#9600)Hugues Ross2020-04-14
* Drop content_sao.{cpp,h}Loic Blot2020-04-11
* Move serveractiveobject & unitsaoLoic Blot2020-04-11
* Drop genericobject.{cpp,h} (#9629)Loïc Blot2020-04-10
* Travis: Build clang jobs with LuaJIT enabled for better coveragesfan52020-04-08
* Utility script to help with Weblate commit importsfan52020-04-03
* Travis: Correct Linux dependencies so that PostgreSQL is found by CMakesfan52020-03-28
* Add comments for translators (#9510)Wuzzy2020-03-20
* Update clang-tidy configuration and scriptssfan52020-03-12
* buildbot: Update to newer MinGW gcc 9.2sfan52020-03-12
* Update travis build infrastructuresfan52020-03-12
* Add animated_image[] formspec element (#9258)Hugues Ross2020-02-15
* Update some libraries for buildbotsfan52020-02-12
* Formspec: Create a new class for inventorylists (#9287)DS2020-02-01
* Add 9-slice background support to button formspec elements (#9290)Hugues Ross2020-01-26
* Refactor to centralize GUIButton styling/rendering code (#9090)Hugues Ross2019-12-09
d">signal_handler_init(void) { // No-op } #endif /* Path mangler */ std::string path_data = "../data"; std::string path_userdata = "../"; void pathRemoveFile(char *path, char delim) { // Remove filename and path delimiter int i; for(i = strlen(path)-1; i>=0; i--) { if(path[i] == delim) break; } path[i] = 0; } void initializePaths() { #ifdef RUN_IN_PLACE /* Use relative paths if RUN_IN_PLACE */ dstream<<"Using relative paths (RUN_IN_PLACE)"<<std::endl; /* Windows */ #if defined(_WIN32) #include <windows.h> const DWORD buflen = 1000; char buf[buflen]; DWORD len; // Find path of executable and set path_data relative to it len = GetModuleFileName(GetModuleHandle(NULL), buf, buflen); assert(len < buflen); pathRemoveFile(buf, '\\'); // Use "./bin/../data" path_data = std::string(buf) + "/../data"; // Use "./bin/../" path_userdata = std::string(buf) + "/../"; /* Linux */ #elif defined(linux) #include <unistd.h> char buf[BUFSIZ]; memset(buf, 0, BUFSIZ); // Get path to executable assert(readlink("/proc/self/exe", buf, BUFSIZ-1) != -1); pathRemoveFile(buf, '/'); // Use "./bin/../data" path_data = std::string(buf) + "/../data"; // Use "./bin/../" path_userdata = std::string(buf) + "/../"; /* OS X */ #elif defined(__APPLE__) //TODO: Get path of executable. This assumes working directory is bin/ dstream<<"WARNING: Relative path not properly supported on OS X" <<std::endl; path_data = std::string("../data"); path_userdata = std::string("../"); #endif #else // RUN_IN_PLACE /* Use platform-specific paths otherwise */ dstream<<"Using system-wide paths (NOT RUN_IN_PLACE)"<<std::endl; /* Windows */ #if defined(_WIN32) #include <windows.h> const DWORD buflen = 1000; char buf[buflen]; DWORD len; // Find path of executable and set path_data relative to it len = GetModuleFileName(GetModuleHandle(NULL), buf, buflen); assert(len < buflen); pathRemoveFile(buf, '\\'); // Use "./bin/../data" path_data = std::string(buf) + "/../data"; //path_data = std::string(buf) + "/../share/" + APPNAME; // Use "C:\Documents and Settings\user\Application Data\<APPNAME>" len = GetEnvironmentVariable("APPDATA", buf, buflen); assert(len < buflen); path_userdata = std::string(buf) + "/" + APPNAME; /* Linux */ #elif defined(linux) #include <unistd.h> char buf[BUFSIZ]; memset(buf, 0, BUFSIZ); // Get path to executable assert(readlink("/proc/self/exe", buf, BUFSIZ-1) != -1); pathRemoveFile(buf, '/'); path_data = std::string(buf) + "/../share/" + APPNAME; //path_data = std::string(INSTALL_PREFIX) + "/share/" + APPNAME; path_userdata = std::string(getenv("HOME")) + "/." + APPNAME; /* OS X */ #elif defined(__APPLE__) #include <unistd.h> // Code based on // http://stackoverflow.com/questions/516200/relative-paths-not-working-in-xcode-c CFBundleRef main_bundle = CFBundleGetMainBundle(); CFURLRef resources_url = CFBundleCopyResourcesDirectoryURL(main_bundle); char path[PATH_MAX]; if(CFURLGetFileSystemRepresentation(resources_url, TRUE, (UInt8 *)path, PATH_MAX)) { dstream<<"Bundle resource path: "<<path<<std::endl; //chdir(path); path_data = std::string(path) + "/data"; } else { // error! dstream<<"WARNING: Could not determine bundle resource path"<<std::endl; } CFRelease(resources_url); path_userdata = std::string(getenv("HOME")) + "/Library/Application Support/" + APPNAME; #endif #endif // RUN_IN_PLACE dstream<<"path_data = "<<path_data<<std::endl; dstream<<"path_userdata = "<<path_userdata<<std::endl; } } //namespace porting