mirror of
https://github.com/vcmi/vcmi.git
synced 2026-06-19 22:57:37 +02:00
Merge pull request #58 from josch/kFreeBSDandHurdSupport
FreeBSD and HURD support
This commit is contained in:
@@ -53,10 +53,18 @@ static_assert(sizeof(bool) == 1, "Bool needs to be 1 byte in size.");
|
||||
# error "Windows CE isn't supported"
|
||||
#elif defined(__linux__) || defined(__gnu_linux__) || defined(linux) || defined(__linux)
|
||||
# define VCMI_UNIX
|
||||
# define VCMI_LINUX
|
||||
# define VCMI_XDG
|
||||
# ifdef __ANDROID__
|
||||
# define VCMI_ANDROID
|
||||
# endif
|
||||
#elif defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
|
||||
# define VCMI_UNIX
|
||||
# define VCMI_XDG
|
||||
# define VCMI_FREEBSD
|
||||
#elif defined(__GNU__) || defined(__gnu_hurd__) || (defined(__MACH__) && !defined(__APPLE))
|
||||
# define VCMI_UNIX
|
||||
# define VCMI_XDG
|
||||
# define VCMI_HURD
|
||||
#elif defined(__APPLE__) && defined(__MACH__)
|
||||
# define VCMI_UNIX
|
||||
# define VCMI_APPLE
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#ifdef VCMI_WINDOWS
|
||||
#include <windows.h>
|
||||
#elif !defined(VCMI_APPLE)
|
||||
#elif !defined(VCMI_APPLE) && !defined(VCMI_FREEBSD) && !defined(VCMI_HURD)
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
/*
|
||||
|
||||
+13
-13
@@ -449,8 +449,8 @@ bfs::path VCMIDirsOSX::libraryPath() const { return "."; }
|
||||
bfs::path VCMIDirsOSX::binaryPath() const { return "."; }
|
||||
|
||||
std::string VCMIDirsOSX::libraryName(const std::string& basename) const { return "lib" + basename + ".dylib"; }
|
||||
#elif defined(VCMI_LINUX)
|
||||
class VCMIDirsLinux : public IVCMIDirsUNIX
|
||||
#elif defined(VCMI_XDG)
|
||||
class VCMIDirsXDG : public IVCMIDirsUNIX
|
||||
{
|
||||
public:
|
||||
boost::filesystem::path userDataPath() const override;
|
||||
@@ -465,7 +465,7 @@ public:
|
||||
std::string libraryName(const std::string& basename) const override;
|
||||
};
|
||||
|
||||
bfs::path VCMIDirsLinux::userDataPath() const
|
||||
bfs::path VCMIDirsXDG::userDataPath() const
|
||||
{
|
||||
// $XDG_DATA_HOME, default: $HOME/.local/share
|
||||
const char* homeDir;
|
||||
@@ -476,7 +476,7 @@ bfs::path VCMIDirsLinux::userDataPath() const
|
||||
else
|
||||
return ".";
|
||||
}
|
||||
bfs::path VCMIDirsLinux::userCachePath() const
|
||||
bfs::path VCMIDirsXDG::userCachePath() const
|
||||
{
|
||||
// $XDG_CACHE_HOME, default: $HOME/.cache
|
||||
const char* tempResult;
|
||||
@@ -487,7 +487,7 @@ bfs::path VCMIDirsLinux::userCachePath() const
|
||||
else
|
||||
return ".";
|
||||
}
|
||||
bfs::path VCMIDirsLinux::userConfigPath() const
|
||||
bfs::path VCMIDirsXDG::userConfigPath() const
|
||||
{
|
||||
// $XDG_CONFIG_HOME, default: $HOME/.config
|
||||
const char* tempResult;
|
||||
@@ -499,7 +499,7 @@ bfs::path VCMIDirsLinux::userConfigPath() const
|
||||
return ".";
|
||||
}
|
||||
|
||||
std::vector<bfs::path> VCMIDirsLinux::dataPaths() const
|
||||
std::vector<bfs::path> VCMIDirsXDG::dataPaths() const
|
||||
{
|
||||
// $XDG_DATA_DIRS, default: /usr/local/share/:/usr/share/
|
||||
|
||||
@@ -528,12 +528,12 @@ std::vector<bfs::path> VCMIDirsLinux::dataPaths() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
bfs::path VCMIDirsLinux::libraryPath() const { return M_LIB_DIR; }
|
||||
bfs::path VCMIDirsLinux::binaryPath() const { return M_BIN_DIR; }
|
||||
bfs::path VCMIDirsXDG::libraryPath() const { return M_LIB_DIR; }
|
||||
bfs::path VCMIDirsXDG::binaryPath() const { return M_BIN_DIR; }
|
||||
|
||||
std::string VCMIDirsLinux::libraryName(const std::string& basename) const { return "lib" + basename + ".so"; }
|
||||
std::string VCMIDirsXDG::libraryName(const std::string& basename) const { return "lib" + basename + ".so"; }
|
||||
#ifdef VCMI_ANDROID
|
||||
class VCMIDirsAndroid : public VCMIDirsLinux
|
||||
class VCMIDirsAndroid : public VCMIDirsXDG
|
||||
{
|
||||
public:
|
||||
boost::filesystem::path userDataPath() const override;
|
||||
@@ -553,7 +553,7 @@ std::vector<bfs::path> VCMIDirsAndroid::dataPaths() const
|
||||
return std::vector<bfs::path>(1, userDataPath());
|
||||
}
|
||||
#endif // VCMI_ANDROID
|
||||
#endif // VCMI_APPLE, VCMI_LINUX
|
||||
#endif // VCMI_APPLE, VCMI_XDG
|
||||
#endif // VCMI_WINDOWS, VCMI_UNIX
|
||||
|
||||
// Getters for interfaces are separated for clarity.
|
||||
@@ -565,8 +565,8 @@ namespace VCMIDirs
|
||||
static VCMIDirsWIN32 singleton;
|
||||
#elif defined(VCMI_ANDROID)
|
||||
static VCMIDirsAndroid singleton;
|
||||
#elif defined(VCMI_LINUX)
|
||||
static VCMIDirsLinux singleton;
|
||||
#elif defined(VCMI_XDG)
|
||||
static VCMIDirsXDG singleton;
|
||||
#elif defined(VCMI_APPLE)
|
||||
static VCMIDirsOSX singleton;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user