|
From: Yoda-JM <yo...@us...> - 2009-07-11 10:04:02
|
Module: performous
Branch: master
Commit: 97db6cbc8dc093d2b8cc3aeb5f6126a631cf95b1
Author: Vincent Le Ligeour <yo...@us...>
Date: Sat Jul 11 12:03:19 2009 +0200
Converted theme pathes into data pathes
---
cmake/performous.sh.cmake | 2 +-
data/performous.xml | 16 ++++++++--------
game/fs.cc | 3 ++-
game/main.cc | 2 ++
4 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/cmake/performous.sh.cmake b/cmake/performous.sh.cmake
index f3d30f7..c2f790f 100644
--- a/cmake/performous.sh.cmake
+++ b/cmake/performous.sh.cmake
@@ -1,4 +1,4 @@
#!/bin/sh
-env PERFORMOUS_CONFIG_SCHEMA='@PERFORMOUS_CONFIG_SCHEMA@' PLUGIN_PATH='@PERFORMOUS_PLUGIN_PATH@' '@PERFORMOUS_EXECUTABLE@' $@
+env PERFORMOUS_DATA_DIR='@CMAKE_INSTALL_PREFIX@/@SHARE_INSTALL@' PERFORMOUS_CONFIG_SCHEMA='@PERFORMOUS_CONFIG_SCHEMA@' PLUGIN_PATH='@PERFORMOUS_PLUGIN_PATH@' '@PERFORMOUS_EXECUTABLE@' $@
diff --git a/data/performous.xml b/data/performous.xml
index c90f84e..e882f54 100644
--- a/data/performous.xml
+++ b/data/performous.xml
@@ -172,14 +172,14 @@
</entry>
<!-- System preferences -->
- <entry name="system/path_themes" type="string_list">
- <stringvalue>/usr/local/share/games/performous/themes/</stringvalue>
- <stringvalue>/usr/share/games/performous/themes/</stringvalue>
- <stringvalue>../themes/</stringvalue><!-- For Windows where the program is started in bin/ -->
- <stringvalue>~/.performous/themes/</stringvalue>
- <locale name="C">
- <short>Theme folders</short>
- <long>Where Performous themes are stored.</long>
+ <entry name="system/path_data" type="string_list">
+ <stringvalue>/usr/local/share/games/performous/</stringvalue>
+ <stringvalue>/usr/share/games/performous/</stringvalue>
+ <stringvalue>../</stringvalue><!-- For Windows where the program is started in bin/ -->
+ <stringvalue>~/.performous/</stringvalue>
+ <locale name="C">
+ <short>Data folders</short>
+ <long>Where Performous data are stored.</long>
</locale>
</entry>
<entry name="system/path_songs" type="string_list">
diff --git a/game/fs.cc b/game/fs.cc
index d9398ae..77a1713 100644
--- a/game/fs.cc
+++ b/game/fs.cc
@@ -31,9 +31,10 @@ std::string getThemePath(std::string const& filename) {
if (theme.empty()) throw std::runtime_error("Configuration value game/theme is empty");
// Figure out theme folder (if theme name rather than path was given)
if (theme.find('/') == std::string::npos) {
- ConfigItem::StringList sd = config["system/path_themes"].sl();
+ ConfigItem::StringList sd = config["system/path_data"].sl();
for (std::vector<std::string>::const_iterator it = sd.begin(); it != sd.end(); ++it) {
fs::path p = *it;
+ p /= "themes/";
p /= theme;
if (fs::is_directory(p)) { theme = p.string(); break; }
}
diff --git a/game/main.cc b/game/main.cc
index 4b935b4..c8580bd 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -264,6 +264,8 @@ int main(int argc, char** argv) {
// Read config files
try {
readConfig();
+ char const* env_data_dir = getenv("PERFORMOUS_DATA_DIR");
+ if(env_data_dir) config["system/path_data"].sl().push_back(std::string(env_data_dir));
} catch (std::exception& e) {
std::cerr << e.what() << std::endl;
return EXIT_FAILURE;
|