ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/AE/Installer/trunk/source/main_window.cpp
(Generate patch)

Comparing AE/Installer/trunk/source/main_window.cpp (file contents):
Revision 396 by gumby, Mon Jul 6 19:18:00 2009 UTC vs.
Revision 397 by iritscen, Mon Jul 6 22:10:17 2009 UTC

# Line 75 | Line 75 | string escapePath(string input) {
75          string output;
76          string escape_me = "& ;()|<>\"'\\#*?$";
77          for(int i = 0; i < input.size(); i++)  {
78 <                for(int j = 0; j < escape_me.size(); j++) if (input[i] == escape_me[j]) output += '//';
78 >                for(int j = 0; j < escape_me.size(); j++) if (input[i] == escape_me[j]) output += '\\';
79                  output += input[i];
80          }
81          return output;
# Line 356 | Line 356 | int globalizeData(void)
356                  create_directory((path)"../GameDataFolder/IGMD");
357                  copy((path)"packages/VanillaBSL/IGMD", (path)"../GameDataFolder");
358                  setProgressBar( 1000 );
359                
360                // CIP:last of all, set up the edition folder as a playable Oni installation by placing the latest application (+ Daodan DLL on Windows) in edition/
361                // or we could just include it in the zip in the proper place already.
359  
360                  copy("../../persist.dat","../persist.dat");
361 <                copy("../../keyconfig.txt","../keyconfig.txt");
361 >                copy("../../key_config.txt","../key_config.txt");
362 >                
363   #ifndef WIN32
364                  /* On Mac only, set the current GDF to the AE GDF by writing to Oni's global preferences file (thankfully a standard OS X ".plist" XML file).
365 <                   If there are no Oni prefs (only possible if Oni has not been run even once), then the above line will fail silently, no harm done,
366 <                   and when the user does run Oni for the first time, using the copy of the app in the AE GDF, Oni will set the prefs to use that GDF at that point */
367 <                path fullAEpath = system_complete("."); // get full path for Installer
368 <                char prefsCommand[300] = "defaults write com.godgames.oni RetailInstallationPath -string '";
369 <                strcat(prefsCommand, fullAEpath.parent_path().parent_path().string().c_str()); // get path of edition/ folder (Oni wants the folder that *contains* the GDF)
365 >                   Tests for presence of prefs with [ -f ] before doing anything so it doesn't create a partial prefs file -- just in case user has never
366 >                   run Oni before :-p */
367 >                string fullAEpath = escapePath(system_complete(".").parent_path().parent_path().string()); // get full path for edition/
368 >                char prefsCommand[300] = "[ -f ~/Library/Preferences/com.godgames.oni.plist ] && defaults write com.godgames.oni RetailInstallationPath -string '";
369 >                strcat(prefsCommand, fullAEpath.c_str()); // get path of edition/ folder (Oni wants the folder that *contains* the GDF)
370                  strcat(prefsCommand, "'"); // path string is enclosed in single quotes to avoid the need to escape UNIX-unfriendly characters
371                  system(prefsCommand);
372                  

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)