|
From: Yoda-JM <yo...@us...> - 2010-03-13 09:52:52
|
Module: performous
Branch: master
Commit: 4a637ae11abdc13b1da1bfb003595f17d0f08e97
Author: Vincent Le Ligeour <yo...@us...>
Date: Sat Mar 13 10:52:32 2010 +0100
Fixed locale folder
---
CMakeLists.txt | 2 +-
game/fs.cc | 13 +++++++++++++
game/fs.hh | 3 +++
game/main.cc | 2 +-
4 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index da4dc2d..9014ff4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,7 +42,7 @@ if(Gettext_FOUND)
elseif(APPLE)
SET(LOCALE_DIR "share/locale")
else()#other os
- SET(LOCALE_DIR "/usr/share/locale")
+ SET(LOCALE_DIR "share/locale")
endif(WIN32)
endif(NOT LOCALE_DIR)
diff --git a/game/fs.cc b/game/fs.cc
index f5d0751..7d1bf96 100644
--- a/game/fs.cc
+++ b/game/fs.cc
@@ -23,6 +23,19 @@ fs::path getHomeDir() {
return dir;
}
+fs::path getLocaleDir() {
+ static fs::path dir;
+
+ if(LOCALEDIR[0] == '/') {
+ dir = LOCALEDIR;
+ } else {
+ dir = plugin::execname().parent_path().parent_path() / LOCALEDIR;
+ std::cout << "REL: " << dir << std::endl;
+ }
+
+ return dir;
+}
+
fs::path getConfigDir() {
static fs::path dir;
diff --git a/game/fs.hh b/game/fs.hh
index 1377f7c..83b03b0 100644
--- a/game/fs.hh
+++ b/game/fs.hh
@@ -12,6 +12,9 @@ fs::path getHomeDir();
/** Get the users configuration folder **/
fs::path getConfigDir();
+/** Get the localec folder **/
+fs::path getLocaleDir();
+
/** Do mangling to convert user-entered path into path suitable for use with stdlib etc. **/
fs::path pathMangle(fs::path const& dir);
diff --git a/game/main.cc b/game/main.cc
index 0c953af..6378538 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -283,7 +283,7 @@ int main(int argc, char** argv) try {
#else
setlocale (LC_MESSAGES, "");
#endif
- bindtextdomain (PACKAGE, LOCALEDIR);
+ bindtextdomain (PACKAGE, getLocaleDir().string().c_str());
textdomain (PACKAGE);
bind_textdomain_codeset (PACKAGE, "UTF-8");
#endif
|