--- AE/Installer/trunk/source/main_window.cpp 2009/07/06 00:59:40 385 +++ AE/Installer/trunk/source/main_window.cpp 2009/07/06 15:39:35 393 @@ -58,6 +58,17 @@ using namespace std; #include "boost/date_time/date_parsing.hpp" #include "boost/date_time/posix_time/posix_time.hpp" +string escapePath(string input) { + + string output; + string escape_me = "& ;()|<>\"'\\#*?$"; + for(int i = 0; i < input.size(); i++) { + for(int j = 0; j < escape_me.size(); j++) if (input[i] == escape_me[j]) output += '\\'; + output += input[i]; + } + return output; +} + int globalizeData(void) { busy = 1; @@ -148,7 +159,6 @@ int globalizeData(void) if (exists("packages/VanillaDats")) remove_all("packages/VanillaDats"); create_directory( "packages/VanillaDats" ); - create_directory( "packages/VanillaDats/level0_Final/" ); //blah blah finish this. //logfile << "packages/VanillaDats/level0_Final/ created"; @@ -261,6 +271,12 @@ int globalizeData(void) if(!exists( Archive / dir_itr->filename())) rename(dir_itr->path(), Archive / dir_itr->filename()); else remove(dir_itr->path()); } + else if (dir_itr->path().filename().substr(0,4) == "ONWC") { //fix for buggy ONWC overriding + cout <path().filename() << "\n"; + + if(!exists( "packages/VanillaDats/level" + levels[i] + "_Final/level" + levels[i] + "_Final/" + dir_itr->filename())) rename(dir_itr->path(), "packages/VanillaDats/level" + levels[i] + "_Final/level" + levels[i] + "_Final/" + dir_itr->filename()); + else remove(dir_itr->path()); + } if (exists(dir_itr->path())) { } @@ -330,21 +346,23 @@ int globalizeData(void) setProgressBar( 1000 ); // 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/ - - // CIP:then copy persist.dat and keyconfig.txt into edition/ as well - + // or we could just include it in the zip in the proper place already. + + copy("../../persist.dat","../persist.dat"); + copy("../../keyconfig.txt","../keyconfig.txt"); #ifndef WIN32 /* 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). 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, 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 */ - path fullAEpath = system_complete("."); // get full path for Installer + string fullAEpath = escapePath(system_complete(".").parent_path().parent_path().string()); // get full path for Installer char prefsCommand[300] = "defaults write com.godgames.oni RetailInstallationPath -string '"; - strcat(prefsCommand, fullAEpath.parent_path().parent_path().string().c_str()); // get path of edition/ folder (Oni wants the folder that *contains* the GDF) + strcat(prefsCommand, fullAEpath.c_str()); // get path of edition/ folder (Oni wants the folder that *contains* the GDF) strcat(prefsCommand, "'"); // path string is enclosed in single quotes to avoid the need to escape UNIX-unfriendly characters system(prefsCommand); #endif + setStatusArea((string)"Done! Now select your mod packages and click install."); // while(1) Sleep(-1); @@ -974,8 +992,13 @@ void MainWindow::CreateControls() itemMenu42->Append(wxID_OPTIONS, _("Show Advanced Options..."), wxEmptyString, wxITEM_CHECK); menuBar->Append(itemMenu42, _("Options")); wxMenu* itemMenu44 = new wxMenu; - itemMenu44->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL); - menuBar->Append(itemMenu44, _("Help")); +#ifdef WIN32 + itemMenu44->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL); + menuBar->Append(itemMenu44, _("Help")); +#else + itemMenu37->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL); +#endif + itemFrame1->SetMenuBar(menuBar); wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); @@ -1116,7 +1139,7 @@ void MainWindow::CreateControls() strImportOption = "-import:nosep"; splitInstances = SPLIT; } - + globalPackages = getPackages(); globalInstalledMods = getInstallString(); for (int i = 0; i < globalPackages.size(); i++) { @@ -1128,11 +1151,14 @@ void MainWindow::CreateControls() TheInstallButton = InstallButton; TheProgressBar = ProgressBar; OptionsPanel->Hide(); + +//#ifndef WIN32 +// itemMenu37->Append(wxID_ABOUT, _("About"), wxEmptyString, wxITEM_NORMAL); + +//#endif + if(splitInstances == SPLIT) SeperatedRadio->SetValue(true); else CompleteRadio->SetValue(true); - - - if(strImportOption == "-import:nosep") NoSepRadio->SetValue(true); else SepRadio->SetValue(true);