[aquaria] What about using Freedesktop config-spec ? (Patch included)

Julien Humbert julroy67 at gmail.com
Thu Apr 21 18:58:00 EDT 2011


Hello everyone !

Aquaria uses ATM the « ~/.Aquaria » config directory, and I think it
is a bad practice. $HOME is cluttered with many « ~/.something » files
and dirs. Freedesktop has a spec for this. Apps should use « ~/.config
» for user config files and « ~/.local/share » for user data.

So I tryed to patch my Aquaria (using latest hg) and I included here
the result of « hg diff ».

Do you think it is ok to use this spec ? Is it well written ? Have I
not introduced a bug ?
Comments are welcome. ;)

Regards
Julien Humbert
-------------- next part --------------
diff -r f2fdf6e483e6 BBGE/Core.cpp
--- a/BBGE/Core.cpp	Sat Apr 16 00:00:00 2011 +0900
+++ b/BBGE/Core.cpp	Fri Apr 22 00:57:04 2011 +0200
@@ -881,10 +881,13 @@
 	#ifdef BBGE_BUILD_MACOSX
 	const std::string prefix("Library/Application Support/");
 	#else
-	const std::string prefix(".");
+	const std::string preferencesPrefix(".config/");
+	const std::string dataPrefix(".local/share/");
 	#endif
 
-	userDataFolder = home + "/" + prefix + userDataSubFolder;
+	userPreferencesFolder = home + "/" + preferencesPrefix + userDataSubFolder;
+	userDataFolder = home + "/" + dataPrefix + userDataSubFolder;
+	mkdir(userPreferencesFolder.c_str(), 0700);
 	mkdir(userDataFolder.c_str(), 0700);
 	debugLogPath = userDataFolder + "/";
 	mkdir((userDataFolder + "/screenshots").c_str(), 0700);
@@ -1039,7 +1042,7 @@
 std::string Core::getPreferencesFolder()
 {
 #ifdef BBGE_BUILD_UNIX
-	return userDataFolder + "/preferences";
+	return userPreferencesFolder + "/preferences";
 #endif
 #ifdef BBGE_BUILD_WINDOWS
 	return "";
diff -r f2fdf6e483e6 BBGE/Core.h
--- a/BBGE/Core.h	Sat Apr 16 00:00:00 2011 +0900
+++ b/BBGE/Core.h	Fri Apr 22 00:57:04 2011 +0200
@@ -1318,6 +1318,7 @@
 
 	void updateCullData();
 
+	std::string userPreferencesFolder;
 	std::string userDataFolder;
 
 	int grabInputOnReentry;


More information about the aquaria mailing list