-void environment_init(int argc, char* argv[])
-{
- args_init(argc, argv);
-
- {
- char *appdata = getenv("APPDATA");
-
- StringOutputStream home(256);
- if(!appdata || string_empty(appdata))
- {
- ERROR_MESSAGE("Application Data folder not available.\n"
- "Radiant will use C:\\ for user preferences.\n");
- home << "C:";
- }
- else
- {
- home << PathCleaned(appdata);
- }
- home << "/NetRadiantSettings/";
- Q_mkdir(home.c_str());
- home_path = home.c_str();
- }
- {
- // get path to the editor
- char filename[MAX_PATH+1];
- GetModuleFileName(0, filename, MAX_PATH);
- char* last_separator = strrchr(filename, '\\');
- if(last_separator != 0)
- {
- *(last_separator+1) = '\0';
- }
- else
- {
- filename[0] = '\0';
- }
- StringOutputStream app(256);
- app << PathCleaned(filename);
- app_path = app.c_str();
- }
- gamedetect();
+void environment_init( int argc, char* argv[] ){
+ args_init( argc, argv );
+
+ {
+ // get path to the editor
+ char filename[MAX_PATH + 1];
+ GetModuleFileName( 0, filename, MAX_PATH );
+ char* last_separator = strrchr( filename, '\\' );
+ if ( last_separator != 0 ) {
+ *( last_separator + 1 ) = '\0';
+ }
+ else
+ {
+ filename[0] = '\0';
+ }
+ StringOutputStream app( 256 );
+ app << PathCleaned( filename );
+ app_path = app.c_str();
+ }
+
+ if ( !portable_app_setup() ) {
+ char *appdata = getenv( "APPDATA" );
+ StringOutputStream home( 256 );
+ if ( !appdata || string_empty( appdata ) ) {
+ ERROR_MESSAGE( "Application Data folder not available.\n"
+ "Radiant will use C:\\ for user preferences.\n" );
+ home << "C:";
+ }
+ else
+ {
+ home << PathCleaned( appdata );
+ }
+ home << "/NetRadiantSettings/";
+ Q_mkdir( home.c_str() );
+ home_path = home.c_str();
+ }
+ gamedetect();