]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/environment.cpp
Merge commit 'ca4a8002f895c3474b3a5087ff027c31dadc712f' into master-merge
[xonotic/netradiant.git] / radiant / environment.cpp
index f79755183bb7682456369cd7fb38c26013328542..e9cf2dc513e6f40f5cb986055fea64049435ab7b 100644 (file)
@@ -110,7 +110,8 @@ bool gamedetect_check_game( char const *gamefile, const char *checkfile1, const
 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 )
        {
@@ -280,25 +281,34 @@ void environment_init( int argc, char const* argv[] ){
        }
 
        {
+#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() ) {
@@ -333,6 +343,18 @@ void environment_init( int argc, char const* argv[] ){
 
 #include <windows.h>
 
+char openCmdMap[260];
+
+void cmdMap(){
+       openCmdMap[0] = '\0';
+       for ( int i = 1; i < g_argc; ++i )
+       {
+               if ( !stricmp( g_argv[i] + strlen(g_argv[i]) - 4, ".map" ) ){
+                       strcpy( openCmdMap, g_argv[i] );
+               }
+       }
+}
+
 void environment_init( int argc, char const* argv[] ){
        args_init( argc, argv );
 
@@ -365,13 +387,18 @@ void environment_init( int argc, char const* argv[] ){
 
        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