diff --git a/src/engine/shared/storage.cpp b/src/engine/shared/storage.cpp index 66495dd49..4a1b93041 100644 --- a/src/engine/shared/storage.cpp +++ b/src/engine/shared/storage.cpp @@ -5,6 +5,9 @@ #include #include "linereader.h" +// compiled-in data-dir path +#define DATA_DIR "data" + class CStorage : public IStorage { public: @@ -169,19 +172,13 @@ public: return; } - #if defined(DATA_DIR) // 2) use compiled-in data-dir if present if(fs_is_dir(DATA_DIR "/mapres")) { str_copy(m_aDatadir, DATA_DIR, sizeof(m_aDatadir)); - #if defined(BINARY_DIR) - str_copy(m_aBinarydir, BINARY_DIR, sizeof(m_aBinarydir)); - #else str_copy(m_aBinarydir, "", sizeof(m_aBinarydir)); - #endif return; } - #endif // 3) check for usable path in argv[0] { @@ -194,13 +191,14 @@ public: { char aBaseDir[MAX_PATH_LENGTH]; str_copy(aBaseDir, pArgv0, Pos+1); + str_copy(m_aBinarydir, aBaseDir, sizeof(m_aBinarydir)); + str_format(m_aDatadir, sizeof(m_aDatadir), "%s/data", aBaseDir); str_append(aBaseDir, "/data/mapres", sizeof(aBaseDir)); + if(fs_is_dir(aBaseDir)) - { - str_copy(m_aBinarydir, aBaseDir, sizeof(m_aBinarydir)); - str_format(m_aDatadir, sizeof(m_aDatadir), "%s/data", aBaseDir); return; - } + else + m_aDatadir[0] = 0; } }