1142 |
|
string popenCommand = "../updates/" + strEUFN + "/install/"; |
1143 |
|
#ifdef WIN32 |
1144 |
|
// TODO: Fill in Windows equivalent of code below :-3 |
1145 |
+ |
popenCommand = "replace_installer.bat"; |
1146 |
|
#else |
1147 |
|
// We can't just use '~' to mean "the home directory" because we need to check the path in C... |
1148 |
|
// ...so we actually get the current user's shortname and manually construct the path to home |
1164 |
|
#endif |
1165 |
|
file.close(); |
1166 |
|
file.clear(); |
1167 |
+ |
#ifdef WIN32 |
1168 |
+ |
system(popenCommand.c_str()); |
1169 |
+ |
#else |
1170 |
|
popen(popenCommand.c_str(), "r"); |
1171 |
< |
|
1171 |
> |
#endif |
1172 |
|
return true; // returning 'true' tells the Installer to quit itself ASAP so it can be replaced by the process that is now running |
1173 |
|
} |
1174 |
|
|
1199 |
|
|
1200 |
|
// TODO: Fill in Windows equivalent of code below |
1201 |
|
#ifdef WIN32 |
1202 |
< |
string strTrashDir = "%RECYCLE%"; |
1202 |
> |
string strTrashDir = "Trash\\"; |
1203 |
|
#else |
1204 |
|
FILE *fUserName = NULL; |
1205 |
|
char chrUserName[32]; |
1244 |
|
needNewTrashDir = true; |
1245 |
|
} |
1246 |
|
} |
1247 |
< |
|
1247 |
> |
#ifndef WIN32 |
1248 |
|
if (!*installerJustUpdated || needNewTrashDir) // prepare a new directory for deleted files to go to |
1249 |
|
{ |
1250 |
|
tm tmStartTime = to_tm(startTime); |
1252 |
|
boost::lexical_cast<string>(tmStartTime.tm_min) + "-" + boost::lexical_cast<string>(tmStartTime.tm_sec) + "/"; |
1253 |
|
create_directory(strTrashDir); |
1254 |
|
} |
1255 |
+ |
#endif |
1256 |
|
file.close(); |
1257 |
|
file.clear(); |
1258 |
|
|
1328 |
|
curPos = thePath.find("/", lastPos); |
1329 |
|
aParentPath = aParentPath + "/"; |
1330 |
|
} |
1331 |
+ |
#ifndef WIN32 |
1332 |
|
rename((path)("../" + thePath), (path)(strTrashDir + thePath)); |
1333 |
+ |
#else |
1334 |
+ |
remove((path)("../" + thePath)); |
1335 |
+ |
#endif |
1336 |
|
} |
1337 |
|
} |
1338 |
|
|
1355 |
|
matchFound = true; |
1356 |
|
if (iter1->modStringVersion > iter2->modStringVersion) |
1357 |
|
{ |
1358 |
+ |
#ifndef WIN32 |
1359 |
|
rename((path)(strPathToPackages + iter2->modStringName), (path)(strTrashDir + iter2->modStringName)); |
1360 |
+ |
#else |
1361 |
+ |
remove((path)(strPathToPackages + iter2->modStringName)); |
1362 |
+ |
#endif |
1363 |
|
rename((path)(strPathToEUFNPackages + iter1->modStringName), (path)(strPathToPackages + iter1->modStringName)); |
1364 |
|
} |
1365 |
|
} |