void gamedetect(){
// if we're inside a Nexuiz install
// default to nexuiz.game (unless the user used an option to inhibit this)
- bool nogamedetect = false;
+ //bool nogamedetect = false;
+ bool nogamedetect = true;
int i;
for ( i = 1; i < g_argc - 1; ++i )
{
return false;
}
+
+const char* openCmdMap;
+
+void cmdMap(){
+ openCmdMap = NULL;
+ for ( int i = 1; i < g_argc; ++i )
+ {
+ //if ( !stricmp( g_argv[i] + strlen(g_argv[i]) - 4, ".map" ) ){
+ if( string_equal_suffix_nocase( g_argv[i], ".map" ) ){
+ openCmdMap = g_argv[i];
+ }
+ }
+}
+
#if GDEF_OS_POSIX
#include <stdlib.h>
}
{
+#if defined(RADIANT_FHS_INSTALL)
StringOutputStream buffer;
- buffer << app_path.c_str() << "../lib/" << RADIANT_BASENAME << "/";
- if ( file_is_directory( buffer.c_str() ) ) {
- lib_path = buffer.c_str();
- }
- else {
- lib_path = app_path.c_str();
- }
+ #if defined(RADIANT_ADDONS_DIR)
+ buffer << RADIANT_ADDONS_DIR << "/";
+ #else
+ buffer << app_path.c_str() << "../lib/";
+ buffer << RADIANT_LIB_ARCH << "/";
+ buffer << RADIANT_BASENAME << "/";
+ #endif
+ lib_path = buffer.c_str();
+#else
+ lib_path = app_path.c_str();
+#endif
}
{
+#if defined(RADIANT_FHS_INSTALL)
StringOutputStream buffer;
- buffer << app_path.c_str() << "../share/" << RADIANT_BASENAME << "/";
- if ( file_is_directory( buffer.c_str() ) ) {
- data_path = buffer.c_str();
- }
- else {
- data_path = app_path.c_str();
- }
+ #if defined(RADIANT_DATA_DIR)
+ buffer << RADIANT_DATA_DIR << "/";
+ #else
+ buffer << app_path.c_str() << "../share/";
+ buffer << RADIANT_BASENAME << "/";
+ #endif
+ data_path = buffer.c_str();
+#else
+ data_path = app_path.c_str();
+#endif
}
if ( !portable_app_setup() ) {
- // this is used on both Linux and macOS
- // but a macOS specific code may be written instead
StringOutputStream home( 256 );
- home << DirectoryCleaned(g_get_user_config_dir()) << "/" << RADIANT_BASENAME << "/";
- // first create ~/.config
- // since it may be missing on brand new home directory
- Q_mkdir( g_get_user_config_dir() );
- // then create ~/.config/netradiant
+#if GDEF_OS_MACOS
+ /* This is used on macOS, this will produce
+ ~/Library/Application Support/NetRadiant folder. */
+ home << DirectoryCleaned( g_get_home_dir() );
+ Q_mkdir( home.c_str() );
+ home << "Library/";
+ Q_mkdir( home.c_str() );
+ home << "Application Support/";
+ Q_mkdir( home.c_str() );
+ home << RADIANT_NAME << "/";
+#else // if GDEF_OS_XDG
+ /* This is used on both Linux and FreeBSD,
+ this will produce ~/.config/netradiant folder
+ when environment has default settings, the
+ XDG_CONFIG_HOME variable modifies it. */
+ home << DirectoryCleaned( g_get_user_config_dir() );
+ Q_mkdir( home.c_str() );
+ home << RADIANT_BASENAME << "/";
+#endif // ! GDEF_OS_MACOS
Q_mkdir( home.c_str() );
home_path = home.c_str();
}
+
gamedetect();
+ cmdMap();
}
#elif GDEF_OS_WINDOWS
if ( !portable_app_setup() ) {
char *appdata = getenv( "APPDATA" );
+
StringOutputStream home( 256 );
home << PathCleaned( appdata );
- home << "/NetRadiantSettings/";
+ home << "/";
+ home << RADIANT_NAME;
+ home << "/";
+
Q_mkdir( home.c_str() );
home_path = home.c_str();
}
gamedetect();
+ cmdMap();
}
#else