name="Nexuiz"
enginepath_win32="C:/Program Files/Nexuiz/"
enginepath_linux="/usr/share/games/nexuiz/"
- enginepath_macos="../../../../.."
+ enginepath_macos="/Applications/Nexuiz"
engine_win32="nexuiz-sdl.exe"
engine_linux="nexuiz-sdl"
engine_macos="Nexuiz.app"
//
#include "preferences.h"
+#include "environment.h"
#include "debugging/debugging.h"
const char* const PREFERENCES_VERSION = "1.0";
-bool Preferences_Load(PreferenceDictionary& preferences, const char* filename)
+bool Preferences_Load(PreferenceDictionary& preferences, const char* filename, const char *cmdline_prefix)
{
+ bool ret = false;
TextFileInputStream file(filename);
if(!file.failed())
{
XMLStreamParser parser(file);
XMLPreferenceDictionaryImporter importer(preferences, PREFERENCES_VERSION);
parser.exportXML(importer);
- return true;
+ ret = true;
}
- return false;
+
+ int l = strlen(cmdline_prefix);
+ for(int i = 1; i < g_argc - 1; ++i)
+ {
+ if(g_argv[i][0] == '-')
+ {
+ if(!strncmp(g_argv[i]+1, cmdline_prefix, l))
+ if(g_argv[i][l+1] == '-')
+ preferences.importPref(g_argv[i]+l+2, g_argv[i+1]);
+ ++i;
+ }
+ }
+
+ return ret;
}
bool Preferences_Save(PreferenceDictionary& preferences, const char* filename)
globalOutputStream() << "loading global preferences from " << makeQuoted(strGlobalPref.c_str()) << "\n";
- if(!Preferences_Load(g_global_preferences, strGlobalPref.c_str()))
+ if(!Preferences_Load(g_global_preferences, strGlobalPref.c_str(), "global"))
{
globalOutputStream() << "failed to load global preferences from " << strGlobalPref.c_str() << "\n";
}
globalOutputStream() << "loading local preferences from " << g_Preferences.m_inipath->str << "\n";
- if(!Preferences_Load(g_preferences, g_Preferences.m_inipath->str))
+ if(!Preferences_Load(g_preferences, g_Preferences.m_inipath->str, g_GamesDialog.m_sGameFile.c_str()))
{
globalOutputStream() << "failed to load local preferences from " << g_Preferences.m_inipath->str << "\n";
}
#export DYLD_LIBRARY_PATH="$MY_DIRECTORY/Contents/MacOS"
cd "$MY_DIRECTORY/Contents/MacOS/install"
+
+# autodetect nexuiz installs
+NEX_DIRECTORY="/${MY_DIRECTORY%/*}"
+while :; do
+ if [ -z "$NEX_DIRECTORY" ]; then
+ break
+ fi
+ if [ -f "$NEX_DIRECTORY/data/common-spog.pk3" ]; then
+ if [ -d "$NEX_DIRECTORY/Nexuiz.app" ]; then
+ break
+ fi
+ fi
+ NEX_DIRECTORY=${NEX_DIRECTORY%/*}
+done
+case "$NEX_DIRECTORY" in
+ //*)
+ NEX_DIRECTORY=${NEX_DIRECTORY#/}
+ set -- -global-gamefile nexuiz.game -nexuiz.game-EnginePath "$NEX_DIRECTORY/"
+ # -global-gamePrompt false?
+ ;;
+ *)
+ set --
+ ;;
+esac
+
if [ -x /usr/bin/open-x11 ]; then
- exec /usr/bin/open-x11 ./radiant.ppc
+ exec /usr/bin/open-x11 ./radiant.ppc "$@"
else
- exec ./radiant.ppc
+ exec ./radiant.ppc "$@"
fi