Use SDL_GetBasePath() instead of physfs because it's buggy in old version
parent
7268bcca11
commit
266944c9d2
|
@ -36,7 +36,7 @@
|
|||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
#include <physfs.h>
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
std::unique_ptr<CSystemUtils> CSystemUtils::Create()
|
||||
{
|
||||
|
@ -177,12 +177,19 @@ float CSystemUtils::TimeStampDiff(SystemTimeStamp *before, SystemTimeStamp *afte
|
|||
return result;
|
||||
}
|
||||
|
||||
std::string CSystemUtils::GetBasePath()
|
||||
{
|
||||
if (m_basePath.empty())
|
||||
m_basePath = SDL_GetBasePath();
|
||||
return m_basePath;
|
||||
}
|
||||
|
||||
std::string CSystemUtils::GetDataPath()
|
||||
{
|
||||
#if DEV_BUILD
|
||||
return std::string{"./"} + COLOBOT_DEFAULT_DATADIR;
|
||||
#else
|
||||
return std::string{PHYSFS_getBaseDir()} + COLOBOT_DEFAULT_DATADIR;
|
||||
return GetBasePath() + COLOBOT_DEFAULT_DATADIR;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -191,7 +198,7 @@ std::string CSystemUtils::GetLangPath()
|
|||
#if DEV_BUILD
|
||||
return std::string{"./"} + COLOBOT_I18N_DIR;
|
||||
#else
|
||||
return std::string{PHYSFS_getBaseDir()} + COLOBOT_I18N_DIR;
|
||||
return GetBasePath() + COLOBOT_I18N_DIR;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -127,6 +127,9 @@ public:
|
|||
/** The difference is \a after - \a before. */
|
||||
virtual long long TimeStampExactDiff(SystemTimeStamp *before, SystemTimeStamp *after) = 0;
|
||||
|
||||
//! Returns the path where the executable binary is located
|
||||
virtual std::string GetBasePath();
|
||||
|
||||
//! Returns the data path (containing textures, levels, helpfiles, etc)
|
||||
virtual std::string GetDataPath();
|
||||
|
||||
|
@ -140,5 +143,6 @@ public:
|
|||
virtual void Usleep(int usecs) = 0;
|
||||
|
||||
private:
|
||||
std::string m_basePath;
|
||||
std::vector<std::unique_ptr<SystemTimeStamp>> m_timeStamps;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue