From a9a71094dd11cec23318c5b663216b4cca959486 Mon Sep 17 00:00:00 2001 From: def Date: Tue, 3 Apr 2018 19:18:27 +0200 Subject: [PATCH] Revert "Allow specifying DATA_DIR by compiler option" This reverts commit 3c488ff5c75ad70b1555c9054ac27a0e487f5900. --- src/engine/shared/storage.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) 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; } }