|
From: Lasse Kärkkäi. <tr...@us...> - 2009-11-14 18:43:12
|
Module: performous
Branch: dance
Commit: f17251a3feae7bc5244608ce7f1f526aa30a5040
Author: Vincent Le Ligeour <yo...@us...>
Date: Tue Nov 10 13:58:03 2009 +0100
Fixed some more pathes search
---
data/schema.xml | 23 +++++++----------------
game/configuration.cc | 3 +--
game/fs.cc | 29 ++++++-----------------------
3 files changed, 14 insertions(+), 41 deletions(-)
diff --git a/data/schema.xml b/data/schema.xml
index 9313de9..c1f6160 100644
--- a/data/schema.xml
+++ b/data/schema.xml
@@ -216,16 +216,6 @@ to save the current settings to XML.
</entry>
<!-- System preferences -->
- <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">
<stringvalue>/usr/local/share/games/ultrastar/songs/</stringvalue>
<stringvalue>/usr/share/games/ultrastar/songs/</stringvalue>
@@ -236,13 +226,14 @@ to save the current settings to XML.
<long>Where to recursively look for songs.</long>
</locale>
</entry>
- <entry name="system/path_share" type="string_list">
- <stringvalue>~/.local/share/performous</stringvalue>
- <stringvalue>../share</stringvalue><!-- For Windows where the program is started in bin/ -->
- <stringvalue>~/.performous/share</stringvalue>
+ <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>Data folders</short>
- <long>Where Performous data are stored.</long>
+ <short>Theme folders</short>
+ <long>Where to look for themes.</long>
</locale>
</entry>
<entry name="system/path_pictures" type="string_list">
diff --git a/game/configuration.cc b/game/configuration.cc
index b144c2b..522393d 100644
--- a/game/configuration.cc
+++ b/game/configuration.cc
@@ -337,8 +337,7 @@ void readConfig() {
// Adding some default pathes
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));
- config["system/path_share"].sl().push_back(std::string(env_data_dir));
+ config["system/path_themes"].sl().push_back(std::string(env_data_dir) + "/themes/");
config["system/path_songs"].sl().push_back(std::string(env_data_dir) + "/songs/");
config["system/path_pictures"].sl().push_back(std::string(env_data_dir) + "/pictures/");
config["system/path_backgrounds"].sl().push_back(std::string(env_data_dir) + "/backgrounds/");
diff --git a/game/fs.cc b/game/fs.cc
index 82a5f93..c9a3039 100644
--- a/game/fs.cc
+++ b/game/fs.cc
@@ -31,10 +31,9 @@ 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_data"].sl();
+ ConfigItem::StringList sd = config["system/path_themes"].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; }
}
@@ -44,26 +43,10 @@ std::string getThemePath(std::string const& filename) {
}
std::string getDataPath(std::string const& filename) {
- // Figure out theme folder (if theme name rather than path was given)
- std::string data_dir;
- 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 = pathMangle(p);
- if (fs::is_directory(p)) { data_dir = p.string(); break; }
- }
- return data_dir + "/" + filename;
-}
-
-std::string getSharePath(std::string const& filename) {
- // Figure out theme folder (if theme name rather than path was given)
- std::string data_dir;
- ConfigItem::StringList sd = config["system/path_share"].sl();
- for (std::vector<std::string>::const_iterator it = sd.begin(); it != sd.end(); ++it) {
- fs::path p = *it;
- p = pathMangle(p);
- if (fs::is_directory(p)) { data_dir = p.string(); break; }
+ char const* env_data_dir = getenv("PERFORMOUS_DATA_DIR");
+ if (env_data_dir) {
+ return std::string(env_data_dir)+filename;
+ } else {
+ return std::string(filename);
}
- return data_dir + "/" + filename;
}
-
|