diff --git a/Source/engine/assets.cpp b/Source/engine/assets.cpp index 98d2fb14f..412756846 100644 --- a/Source/engine/assets.cpp +++ b/Source/engine/assets.cpp @@ -330,7 +330,7 @@ std::vector GetMPQSearchPaths() if (paths[0] == paths[1] || (paths.size() == 3 && (paths[0] == paths[2] || paths[1] == paths[2]))) paths.pop_back(); -#if (defined(__unix__) || defined(__APPLE__)) && !defined(__ANDROID__) +#if (defined(__unix__) || defined(__APPLE__)) && !defined(__ANDROID__) && !defined(__DJGPP__) // `XDG_DATA_HOME` is usually the root path of `paths::PrefPath()`, so we only // add `XDG_DATA_DIRS`. const char *xdgDataDirs = std::getenv("XDG_DATA_DIRS"); diff --git a/Source/utils/file_util.h b/Source/utils/file_util.h index 0e5d9e1f5..da9ffda46 100644 --- a/Source/utils/file_util.h +++ b/Source/utils/file_util.h @@ -9,7 +9,7 @@ namespace devilution { -#ifdef _WIN32 +#if defined(_WIN32) || defined(__DJGPP__) constexpr char DirectorySeparator = '\\'; #define DIRECTORY_SEPARATOR_STR "\\" #else diff --git a/Source/utils/paths.cpp b/Source/utils/paths.cpp index a0c60dd45..6b300742e 100644 --- a/Source/utils/paths.cpp +++ b/Source/utils/paths.cpp @@ -42,7 +42,7 @@ void AddTrailingSlash(std::string &path) path += DirectorySeparator; } -std::string FromSDL(char *s) +[[maybe_unused]] std::string FromSDL(char *s) { const SDLUniquePtr pinned(s); std::string result = (s != nullptr ? s : ""); @@ -72,7 +72,11 @@ const std::string &NxdkGetPrefPath() const std::string &BasePath() { if (!basePath) { +#if defined(__DJGPP__) + basePath = std::string(); +#else basePath = FromSDL(SDL_GetBasePath()); +#endif } return *basePath; } @@ -80,13 +84,15 @@ const std::string &BasePath() const std::string &PrefPath() { if (!prefPath) { -#if defined(__IPHONEOS__) +#if defined(__DJGPP__) + prefPath = std::string(); +#elif defined(__IPHONEOS__) prefPath = FromSDL(IOSGetPrefPath()); #elif defined(NXDK) prefPath = NxdkGetPrefPath(); #else prefPath = FromSDL(SDL_GetPrefPath("diasurgical", "devilution")); -#if !defined(__amigaos__) +#if !defined(__amigaos__) && !defined(__DJGPP__) if (FileExistsAndIsWriteable("diablo.ini")) { prefPath = std::string(); } @@ -99,13 +105,15 @@ const std::string &PrefPath() const std::string &ConfigPath() { if (!configPath) { -#if defined(__IPHONEOS__) +#if defined(__DJGPP__) + configPath = std::string(); +#elif defined(__IPHONEOS__) configPath = FromSDL(IOSGetPrefPath()); #elif defined(NXDK) configPath = NxdkGetPrefPath(); #else configPath = FromSDL(SDL_GetPrefPath("diasurgical", "devilution")); -#if !defined(__amigaos__) +#if !defined(__amigaos__) && !defined(__DJGPP__) if (FileExistsAndIsWriteable("diablo.ini")) { configPath = std::string(); } @@ -118,8 +126,8 @@ const std::string &ConfigPath() const std::string &AssetsPath() { if (!assetsPath) { -#if __EMSCRIPTEN__ - assetsPath.emplace("assets/"); +#if __EMSCRIPTEN__ || defined(__DJGPP__) + assetsPath.emplace("assets" DIRECTORY_SEPARATOR_STR); #elif defined(NXDK) assetsPath.emplace("D:\\assets\\"); #elif defined(__3DS__) || defined(__SWITCH__)