summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Cellerier <dionoea@videolan.org>2007-06-10 22:08:48 +0000
committerAntoine Cellerier <dionoea@videolan.org>2007-06-10 22:08:48 +0000
commit1bc4ce9a0a949c4b93451354d5d53ae838b3659c (patch)
tree19b4bbe16f24cf095b42826090220435b0bf60c9
parent71eedc7a5be6b01fc910967e93ef7f3acf92eeaf (diff)
downloadrockbox-1bc4ce9a0a949c4b93451354d5d53ae838b3659c.tar.gz
rockbox-1bc4ce9a0a949c4b93451354d5d53ae838b3659c.zip
Simplify code (use + operator to concatenate strings instead of Printf()). Please revert if use of Printf was intentional.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13612 a1c6a512-1295-4272-9138-f99709370657
-rwxr-xr-xrbutil/bootloaders.cpp140
-rw-r--r--rbutil/install_dialogs.cpp4
-rw-r--r--rbutil/installlog.cpp15
-rwxr-xr-xrbutil/irivertools.cpp35
-rw-r--r--rbutil/rbutil.cpp150
-rw-r--r--rbutil/rbutilApp.cpp15
-rw-r--r--rbutil/rbutilCtrls.cpp18
-rw-r--r--rbutil/rbutilFrm.cpp102
8 files changed, 224 insertions, 255 deletions
diff --git a/rbutil/bootloaders.cpp b/rbutil/bootloaders.cpp
index 039451f247..56f936e4ff 100755
--- a/rbutil/bootloaders.cpp
+++ b/rbutil/bootloaders.cpp
@@ -55,14 +55,14 @@ bool ipodpatcher(int mode,wxString bootloadername)
55 // downloading files 55 // downloading files
56 if(mode == BOOTLOADER_ADD) 56 if(mode == BOOTLOADER_ADD)
57 { 57 {
58 src.Printf(wxT("%s/ipod/%s.ipod"),gv->bootloader_url.c_str(),bootloadername.c_str()); 58 src = gv->bootloader_url + wxT("/ipod/")
59 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), 59 + bootloadername + wxT(".ipod");
60 gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str()); 60 dest = gv->stdpaths->GetUserDataDir()
61 + wxT("" PATH_SEP "download" PATH_SEP) + bootloadername;
61 if ( DownloadURL(src, dest) ) 62 if ( DownloadURL(src, dest) )
62 { 63 {
63 wxRemoveFile(dest); 64 wxRemoveFile(dest);
64 buf.Printf(wxT("Unable to download %s"), src.c_str() ); 65 ERR_DIALOG(wxT("Unable to download ") + src, wxT("Install"));
65 ERR_DIALOG(buf, wxT("Install"));
66 return false; 66 return false;
67 } 67 }
68 } 68 }
@@ -191,14 +191,14 @@ bool sansapatcher(int mode,wxString bootloadername)
191 // downloading files 191 // downloading files
192 if(mode == BOOTLOADER_ADD) 192 if(mode == BOOTLOADER_ADD)
193 { 193 {
194 src.Printf(wxT("%s/sandisk-sansa/e200/%s"),gv->bootloader_url.c_str(),bootloadername.c_str()); 194 src = gv->bootloader_url + wxT("/sandisk-sansa/e200/")
195 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), 195 + bootloadername;
196 gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str()); 196 dest = gv->stdpaths->GetUserDataDir()
197 + wxT("" PATH_SEP "download" PATH_SEP) + bootloadername;
197 if ( DownloadURL(src, dest) ) 198 if ( DownloadURL(src, dest) )
198 { 199 {
199 wxRemoveFile(dest); 200 wxRemoveFile(dest);
200 buf.Printf(wxT("Unable to download %s"), src.c_str() ); 201 ERR_DIALOG(wxT("Unable to download ") + src, wxT("Download"));
201 ERR_DIALOG(buf, wxT("Download"));
202 return false; 202 return false;
203 } 203 }
204 } 204 }
@@ -270,27 +270,26 @@ bool gigabeatf(int mode,wxString bootloadername,wxString deviceDir)
270 wxString err; 270 wxString err;
271 wxString src,dest; 271 wxString src,dest;
272 272
273 path1.Printf(wxT("%s" PATH_SEP "GBSYSTEM" PATH_SEP "FWIMG" PATH_SEP "FWIMG01.DAT"),deviceDir.c_str()); 273 path1 = deviceDir
274 + wxT("" PATH_SEP "GBSYSTEM" PATH_SEP "FWIMG" PATH_SEP "FWIMG01.DAT");
274 275
275 if(mode == BOOTLOADER_ADD) 276 if(mode == BOOTLOADER_ADD)
276 { 277 {
277 //Files downloaden 278 //Files downloaden
278 src.Printf(wxT("%s/gigabeat/%s"), gv->bootloader_url.c_str(),bootloadername.c_str()); 279 src = gv->bootloader_url + wxT("/gigabeat/") + bootloadername;
279 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), 280 dest = gv->stdpaths->GetUserDataDir()
280 gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str()); 281 + wxT("" PATH_SEP "download" PATH_SEP) + bootloadername;
281 if( DownloadURL(src, dest) ) 282 if( DownloadURL(src, dest) )
282 { 283 {
283 wxRemoveFile(dest); 284 wxRemoveFile(dest);
284 err.Printf(wxT("Unable to download %s"), src.c_str() ); 285 ERR_DIALOG(wxT("Unable to download ") + src, wxT("Install"));
285 ERR_DIALOG(err, wxT("Install"));
286 return false; 286 return false;
287 } 287 }
288 288
289 289
290 if(!wxFileExists(path1)) 290 if(!wxFileExists(path1))
291 { 291 {
292 err.Printf(wxT("[ERR] Coud not find %s"),path1.c_str()); 292 ERR_DIALOG(wxT("[ERR] Coud not find ")+path1, wxT("Bootloader add"));
293 ERR_DIALOG(err, wxT("Bootloader add"));
294 return false; 293 return false;
295 } 294 }
296 path2 = path1; 295 path2 = path1;
@@ -299,8 +298,8 @@ bool gigabeatf(int mode,wxString bootloadername,wxString deviceDir)
299 { 298 {
300 if(!wxRenameFile(path1,path2,false)) 299 if(!wxRenameFile(path1,path2,false))
301 { 300 {
302 err.Printf(wxT("[ERR] Coud not rename %s to %s"),path1.c_str(),path2.c_str()); 301 ERR_DIALOG(wxT("[ERR] Coud not rename ") + path1 + wxT(" to ")
303 ERR_DIALOG(err, wxT("Bootloader add")); 302 + path2, wxT("Bootloader add"));
304 return false; 303 return false;
305 } 304 }
306 } 305 }
@@ -308,8 +307,8 @@ bool gigabeatf(int mode,wxString bootloadername,wxString deviceDir)
308 307
309 if(!wxCopyFile(dest,path1)) 308 if(!wxCopyFile(dest,path1))
310 { 309 {
311 err.Printf(wxT("[ERR] Coud not copy %s to %s"),dest.c_str(),path2.c_str()); 310 ERR_DIALOG(wxT("[ERR] Coud not copy ") + dest + wxT(" to ")
312 ERR_DIALOG(err, wxT("Bootloader add")); 311 + path2, wxT("Bootloader add"));
313 return false; 312 return false;
314 } 313 }
315 } 314 }
@@ -319,14 +318,14 @@ bool gigabeatf(int mode,wxString bootloadername,wxString deviceDir)
319 path2.Append(wxT(".ORIG")); 318 path2.Append(wxT(".ORIG"));
320 if(!wxFileExists(path2)) 319 if(!wxFileExists(path2))
321 { 320 {
322 err.Printf(wxT("[ERR] Coud not find %s"),path1.c_str()); 321 ERR_DIALOG(wxT("[ERR] Coud not find ") + path1,
323 ERR_DIALOG(err, wxT("Bootloader del")); 322 wxT("Bootloader del"));
324 return false; 323 return false;
325 } 324 }
326 if(!wxRenameFile(path2,path1,true)) 325 if(!wxRenameFile(path2,path1,true))
327 { 326 {
328 err.Printf(wxT("[ERR] Coud not rename %s to %s"),path1.c_str(),path2.c_str()); 327 ERR_DIALOG(wxT("[ERR] Coud not rename ") + path1 + wxT(" to ")
329 ERR_DIALOG(err, wxT("Bootloader del")); 328 + path2, wxT("Bootloader del"));
330 return false; 329 return false;
331 } 330 }
332 } 331 }
@@ -340,27 +339,27 @@ bool iaudiox5(int mode,wxString bootloadername,wxString deviceDir)
340 wxString err; 339 wxString err;
341 wxString src,dest; 340 wxString src,dest;
342 341
343 path1.Printf(wxT("%s" PATH_SEP "FIRMWARE" PATH_SEP "%s"),deviceDir.c_str(),bootloadername.c_str()); 342 path1 = deviceDir + wxT("" PATH_SEP "FIRMWARE" PATH_SEP)
343 + bootloadername;
344 344
345 if(mode == BOOTLOADER_ADD) 345 if(mode == BOOTLOADER_ADD)
346 { 346 {
347 //Files downloaden 347 //Files downloaden
348 src.Printf(wxT("%s/iaudio/%s"),gv->bootloader_url.c_str(),bootloadername.c_str()); 348 src = gv->bootloader_url + wxT("/iaudio/") + bootloadername;
349 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), 349 dest = gv->stdpaths->GetUserDataDir()
350 gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str()); 350 + wxT("" PATH_SEP "download" PATH_SEP) + bootloadername;
351 if( DownloadURL(src, dest) ) 351 if( DownloadURL(src, dest) )
352 { 352 {
353 wxRemoveFile(dest); 353 wxRemoveFile(dest);
354 err.Printf(wxT("Unable to download %s"), src.c_str() ); 354 ERR_DIALOG(wxT("Unable to download ") + src, wxT("Install"));
355 ERR_DIALOG(err, wxT("Install"));
356 return false; 355 return false;
357 } 356 }
358 357
359 // copy file 358 // copy file
360 if(!wxCopyFile(dest,path1)) 359 if(!wxCopyFile(dest,path1))
361 { 360 {
362 err.Printf(wxT("[ERR] Coud not copy %s to %s"),dest.c_str(),path2.c_str()); 361 ERR_DIALOG(wxT("[ERR] Coud not copy ")+dest+wxT(" to ")+path2,
363 ERR_DIALOG(err, wxT("Bootloader add")); 362 wxT("Bootloader add"));
364 return false; 363 return false;
365 } 364 }
366 365
@@ -383,27 +382,26 @@ bool h10(int mode,wxString bootloadername,wxString deviceDir)
383 if(mode == BOOTLOADER_ADD) 382 if(mode == BOOTLOADER_ADD)
384 { 383 {
385 //Files downloaden 384 //Files downloaden
386 src.Printf(wxT("%s/iriver/%s"), gv->bootloader_url.c_str(),bootloadername.c_str()); 385 src = gv->bootloader_url + wxT("/iriver/") + bootloadername;
387 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), 386 dest = gv->stdpaths->GetUserDataDir()
388 gv->stdpaths->GetUserDataDir().c_str(),firmwarename.c_str()); 387 + wxT("" PATH_SEP "download" PATH_SEP) + firmwarename;
389 if( DownloadURL(src, dest) ) 388 if( DownloadURL(src, dest) )
390 { 389 {
391 wxRemoveFile(dest); 390 wxRemoveFile(dest);
392 err.Printf(wxT("Unable to download %s"), src.c_str() ); 391 ERR_DIALOG(wxT("Unable to download ") + src, wxT("Install"));
393 ERR_DIALOG(err, wxT("Install"));
394 return false; 392 return false;
395 } 393 }
396 394
397 path1.Printf(wxT("%sSYSTEM" PATH_SEP "%s"),deviceDir.c_str(),firmwarename.c_str()); 395 path1 = deviceDir + wxT("SYSTEM" PATH_SEP) + firmwarename;
398 path2.Printf(wxT("%sSYSTEM" PATH_SEP "Original.mi4"),deviceDir.c_str()); 396 path2 = deviceDir + wxT("SYSTEM" PATH_SEP "Original.mi4");
399 397
400 if(!wxFileExists(path1)) //Firmware dosent exists on player 398 if(!wxFileExists(path1)) //Firmware dosent exists on player
401 { 399 {
402 path1.Printf(wxT("%sSYSTEM" PATH_SEP "H10EMP.mi4"),deviceDir.c_str()); //attempt other firmwarename 400 path1 = deviceDir + wxT("SYSTEM" PATH_SEP "H10EMP.mi4"); //attempt other firmwarename
403 if(!wxFileExists(path1)) //Firmware dosent exists on player 401 if(!wxFileExists(path1)) //Firmware dosent exists on player
404 { 402 {
405 err.Printf(wxT("[ERR] File %s does not Exist"),path1.c_str()); 403 ERR_DIALOG(wxT("[ERR] File ") + path1 + wxT(" does not Exist"),
406 ERR_DIALOG(err, wxT("Bootloader add")); 404 wxT("Bootloader add"));
407 return false; 405 return false;
408 } 406 }
409 } 407 }
@@ -411,16 +409,16 @@ bool h10(int mode,wxString bootloadername,wxString deviceDir)
411 { 409 {
412 if(!wxRenameFile(path1,path2,false)) //rename Firmware to Original 410 if(!wxRenameFile(path1,path2,false)) //rename Firmware to Original
413 { 411 {
414 err.Printf(wxT("[ERR] Coud not rename %s to %s"),path1.c_str(),path2.c_str()); 412 ERR_DIALOG(wxT("[ERR] Coud not rename ") + path1 + wxT(" to ")
415 ERR_DIALOG(err, wxT("Bootloader add")); 413 + path2, wxT("Bootloader add"));
416 return false; 414 return false;
417 } 415 }
418 } 416 }
419 417
420 if(!wxCopyFile(dest,path1)) // copy file 418 if(!wxCopyFile(dest,path1)) // copy file
421 { 419 {
422 err.Printf(wxT("[ERR] Coud not copy %s to %s"),dest.c_str(),path1.c_str()); 420 ERR_DIALOG(wxT("[ERR] Coud not copy ") + dest + wxT(" to ") + path1,
423 ERR_DIALOG(err,wxT("Bootloader add")); 421 wxT("Bootloader add"));
424 return false; 422 return false;
425 } 423 }
426 424
@@ -429,30 +427,30 @@ bool h10(int mode,wxString bootloadername,wxString deviceDir)
429 } 427 }
430 else if(mode == BOOTLOADER_REM) 428 else if(mode == BOOTLOADER_REM)
431 { 429 {
432 path1.Printf(wxT("%sSYSTEM" PATH_SEP "%s"),deviceDir.c_str(),firmwarename.c_str()); 430 path1 = deviceDir + wxT("SYSTEM" PATH_SEP) + firmwarename;
433 path2.Printf(wxT("%sSYSTEM" PATH_SEP "Original.mi4"),gv->curdestdir.c_str()); 431 path2 = gv->curdestdir + wxT("SYSTEM" PATH_SEP "Original.mi4");
434 if(!wxFileExists(path1)) //Firmware dosent exists on player 432 if(!wxFileExists(path1)) //Firmware dosent exists on player
435 { 433 {
436 path1.Printf(wxT("%s" PATH_SEP "SYSTEM" PATH_SEP "H10EMP.mi4"),deviceDir.c_str()); //attempt other firmwarename 434 path1 = deviceDir + wxT("" PATH_SEP "SYSTEM" PATH_SEP "H10EMP.mi4"); //attempt other firmwarename
437 if(!wxFileExists(path1)) //Firmware dosent exists on player 435 if(!wxFileExists(path1)) //Firmware dosent exists on player
438 { 436 {
439 err.Printf(wxT("[ERR] File %s does not Exist"),path1.c_str()); 437 ERR_DIALOG(wxT("[ERR] File ") + path1 + wxT(" does not Exist"),
440 ERR_DIALOG(err, wxT("Bootloader rem")); 438 wxT("Bootloader rem"));
441 return false; 439 return false;
442 } 440 }
443 } 441 }
444 442
445 if(!wxFileExists(path2)) //Original Firmware dosent exists on player 443 if(!wxFileExists(path2)) //Original Firmware dosent exists on player
446 { 444 {
447 err.Printf(wxT("[ERR] File %s does not Exist"),path2.c_str()); 445 ERR_DIALOG(wxT("[ERR] File ") + path2 + wxT(" does not Exist"),
448 ERR_DIALOG(err, wxT("Bootloader rem")); 446 wxT("Bootloader rem"));
449 return false; 447 return false;
450 } 448 }
451 449
452 if(!wxRenameFile(path2,path1,true)) //rename Firmware to Original 450 if(!wxRenameFile(path2,path1,true)) //rename Firmware to Original
453 { 451 {
454 err.Printf(wxT("[ERR] Coud not rename %s to %s"),path2.c_str(),path1.c_str()); 452 ERR_DIALOG(wxT("[ERR] Coud not rename ") + path2 + wxT(" to ")
455 ERR_DIALOG(err, wxT("Bootloader add")); 453 + path1, wxT("Bootloader add"));
456 return false; 454 return false;
457 } 455 }
458 456
@@ -503,38 +501,42 @@ bool fwpatcher(int mode,wxString bootloadername,wxString deviceDir,wxString firm
503 else 501 else
504 { 502 {
505 //Download bootloader 503 //Download bootloader
506 src.Printf(wxT("%s/iriver/%s"), gv->bootloader_url.c_str(),bootloadername.c_str()); 504 src = gv->bootloader_url + wxT("/iriver/")
507 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), 505 + bootloadername;
508 gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str()); 506 dest = gv->stdpaths->GetUserDataDir()
507 + wxT("" PATH_SEP "download" PATH_SEP)
508 + bootloadername;
509 if( DownloadURL(src, dest) ) 509 if( DownloadURL(src, dest) )
510 { 510 {
511 wxRemoveFile(dest); 511 wxRemoveFile(dest);
512 err.Printf(wxT("Unable to download %s"), src.c_str() ); 512 ERR_DIALOG(wxT("Unable to download ") + src,
513 ERR_DIALOG(err, wxT("Install")); 513 wxT("Install"));
514 return false; 514 return false;
515 } 515 }
516 516
517 if(!PatchFirmware(firmware,dest,series, table_entry)) // Patch firmware 517 if(!PatchFirmware(firmware,dest,series, table_entry)) // Patch firmware
518 { 518 {
519 ERR_DIALOG(wxT("Patching Firmware failed"), wxT("Patching Firmware")); 519 ERR_DIALOG(wxT("Patching Firmware failed"),
520 wxT("Patching Firmware"));
520 return false; 521 return false;
521 } 522 }
522 } 523 }
523 524
524 // Load patched Firmware to player 525 // Load patched Firmware to player
525 src.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "new.hex"), 526 src = gv->stdpaths->GetUserDataDir()
526 gv->stdpaths->GetUserDataDir().c_str()); 527 + wxT("" PATH_SEP "download" PATH_SEP "new.hex");
527 528
528 if(gv->curplat == wxT("h100")) 529 if(gv->curplat == wxT("h100"))
529 dest.Printf(wxT("%s" PATH_SEP "ihp_100.hex"),deviceDir.c_str()); 530 dest = deviceDir + wxT("" PATH_SEP "ihp_100.hex");
530 else if(gv->curplat == wxT("h120")) 531 else if(gv->curplat == wxT("h120"))
531 dest.Printf(wxT("%s" PATH_SEP "ihp_120.hex"),deviceDir.c_str()); 532 dest = deviceDir + wxT("" PATH_SEP "ihp_120.hex");
532 else if(gv->curplat == wxT("h300")) 533 else if(gv->curplat == wxT("h300"))
533 dest.Printf(wxT("%s" PATH_SEP "H300.hex"),deviceDir.c_str()); 534 dest = deviceDir + wxT("" PATH_SEP "H300.hex");
534 535
535 if(!wxRenameFile(src,dest)) 536 if(!wxRenameFile(src,dest))
536 { 537 {
537 ERR_DIALOG(wxT("Copying Firmware to Device failed"), wxT("Copying Firmware")); 538 ERR_DIALOG(wxT("Copying Firmware to Device failed"),
539 wxT("Copying Firmware"));
538 return false; 540 return false;
539 } 541 }
540 else 542 else
diff --git a/rbutil/install_dialogs.cpp b/rbutil/install_dialogs.cpp
index 40f1ea0588..b7607fa4d9 100644
--- a/rbutil/install_dialogs.cpp
+++ b/rbutil/install_dialogs.cpp
@@ -528,9 +528,7 @@ void rockboxInstallDlg::CreateControls()
528 wxBoxSizer3->Add(WxStaticText1,0,wxGROW | wxALL,5); 528 wxBoxSizer3->Add(WxStaticText1,0,wxGROW | wxALL,5);
529 529
530 wxArrayString array; 530 wxArrayString array;
531 wxString buf; 531 array.Add(wxT("Rockbox stable version (") + gv->last_release + wxT(")"));
532 buf.Printf(wxT("Rockbox stable version (%s)") , gv->last_release.c_str());
533 array.Add(buf);
534 array.Add(wxT("Archived Build")); 532 array.Add(wxT("Archived Build"));
535 array.Add(wxT("Current Build ")); 533 array.Add(wxT("Current Build "));
536 534
diff --git a/rbutil/installlog.cpp b/rbutil/installlog.cpp
index 4be4a97352..7f6fa999f6 100644
--- a/rbutil/installlog.cpp
+++ b/rbutil/installlog.cpp
@@ -33,8 +33,7 @@ InstallLog::InstallLog(wxString logname, bool CreateLog)
33 33
34 if (!logfile) 34 if (!logfile)
35 { 35 {
36 buf.Printf(_("Failed to create install log file: %s"), logname.c_str()); 36 wxLogWarning(_("Failed to create install log file: ") + logname);
37 wxLogWarning(buf);
38 return; 37 return;
39 } 38 }
40 39
@@ -42,8 +41,7 @@ InstallLog::InstallLog(wxString logname, bool CreateLog)
42 if (logfile->Exists(wxT("Version")) && 41 if (logfile->Exists(wxT("Version")) &&
43 logfile->Read(wxT("Version"), 0l) != LOGFILE_VERSION ) 42 logfile->Read(wxT("Version"), 0l) != LOGFILE_VERSION )
44 { 43 {
45 buf.Printf(_("Logfile version mismatch: %s"), logname.c_str() ); 44 wxLogWarning(_("Logfile version mismatch: ") + logname);
46 wxLogWarning(buf);
47 delete logfile; 45 delete logfile;
48 return; 46 return;
49 } 47 }
@@ -122,14 +120,14 @@ void InstallLog::EnumerateCurDir(wxString curdir)
122 wxString curname, buf, buf2, pathcache; 120 wxString curname, buf, buf2, pathcache;
123 long dummy; 121 long dummy;
124 122
125 buf.Printf(wxT("/FilePaths/%s"), curdir.c_str()); 123 buf = wxT("/FilePaths/") + curdir;
126 pathcache = logfile->GetPath(); 124 pathcache = logfile->GetPath();
127 logfile->SetPath(buf); 125 logfile->SetPath(buf);
128 126
129 contflag = logfile->GetFirstGroup(curname, dummy); 127 contflag = logfile->GetFirstGroup(curname, dummy);
130 while (contflag) 128 while (contflag)
131 { 129 {
132 buf.Printf(wxT("%s/%s"), curdir.c_str(), curname.c_str() ); 130 buf = curdir + wxT("/") + curname;
133 buf2 = buf; buf2.Replace(wxT("/"), PATH_SEP); 131 buf2 = buf; buf2.Replace(wxT("/"), PATH_SEP);
134 workingAS.Add(buf2); 132 workingAS.Add(buf2);
135 EnumerateCurDir(buf); 133 EnumerateCurDir(buf);
@@ -141,9 +139,8 @@ void InstallLog::EnumerateCurDir(wxString curdir)
141 { 139 {
142 if (curname != wxT(DIRECTORY_KLUDGE) ) 140 if (curname != wxT(DIRECTORY_KLUDGE) )
143 { 141 {
144 buf.Printf(wxT("%s/%s"), curdir.c_str(), curname.c_str() ); 142 buf = curdir + wxT("" PATH_SEP) + curname;
145 buf2 = buf; buf2.Replace(wxT("/"), PATH_SEP); 143 workingAS.Add(buf);
146 workingAS.Add(buf2);
147 } 144 }
148 contflag = logfile->GetNextEntry(curname, dummy); 145 contflag = logfile->GetNextEntry(curname, dummy);
149 } 146 }
diff --git a/rbutil/irivertools.cpp b/rbutil/irivertools.cpp
index 65891d546b..1e6341923d 100755
--- a/rbutil/irivertools.cpp
+++ b/rbutil/irivertools.cpp
@@ -61,8 +61,7 @@ bool mkboot(wxString infile, wxString outfile,wxString bootloader,int origin)
61 wxFile f; 61 wxFile f;
62 if(!f.Open(infile)) 62 if(!f.Open(infile))
63 { 63 {
64 err.Printf(wxT("Could not open: %s"),infile.c_str()); 64 ERR_DIALOG(wxT("Could not open: ") + infile, wxT("mkboot"));
65 ERR_DIALOG(err, wxT("mkboot"));
66 return false; 65 return false;
67 } 66 }
68 i = f.Read(image,16); 67 i = f.Read(image,16);
@@ -88,8 +87,7 @@ bool mkboot(wxString infile, wxString outfile,wxString bootloader,int origin)
88 /* Now, read the boot loader into the image */ 87 /* Now, read the boot loader into the image */
89 if(!f.Open(bootloader)) 88 if(!f.Open(bootloader))
90 { 89 {
91 err.Printf(wxT("Could not open: %s"),bootloader.c_str()); 90 ERR_DIALOG(wxT("Could not open: ") + bootloader, wxT("mkboot"));
92 ERR_DIALOG(err, wxT("mkboot"));
93 return false; 91 return false;
94 } 92 }
95 93
@@ -105,8 +103,7 @@ bool mkboot(wxString infile, wxString outfile,wxString bootloader,int origin)
105 103
106 if(!f.Open(outfile,wxFile::write)) 104 if(!f.Open(outfile,wxFile::write))
107 { 105 {
108 err.Printf(wxT("Could not open: %s"),outfile.c_str()); 106 ERR_DIALOG(wxT("Could not open: ") + outfile, wxT("mkboot"));
109 ERR_DIALOG(err, wxT("mkboot"));
110 return false; 107 return false;
111 } 108 }
112 109
@@ -230,14 +227,13 @@ int iriver_decode(wxString infile_name, wxString outfile_name, unsigned int modi
230 227
231 if(!infile.Open(infile_name)) 228 if(!infile.Open(infile_name))
232 { 229 {
233 err.Printf(wxT("Could not open: %s"),infile_name.c_str()); 230 ERR_DIALOG(wxT("Could not open: ") + infile_name, wxT("iriver_decode"));
234 ERR_DIALOG(err, wxT("iriver_decode"));
235 return -1; 231 return -1;
236 } 232 }
237 if(!outfile.Open(outfile_name,wxFile::write)) 233 if(!outfile.Open(outfile_name,wxFile::write))
238 { 234 {
239 err.Printf(wxT("Could not open: %s"),outfile_name.c_str()); 235 ERR_DIALOG(wxT("Could not open: ") + outfile_name,
240 ERR_DIALOG(err, wxT("iriver_decode")); 236 wxT("iriver_decode"));
241 return -1; 237 return -1;
242 } 238 }
243 lenread = infile.Read( headerdata, 512); 239 lenread = infile.Read( headerdata, 512);
@@ -417,14 +413,13 @@ int iriver_encode(wxString infile_name, wxString outfile_name, unsigned int modi
417 413
418 if(!infile.Open(infile_name,wxFile::read)) 414 if(!infile.Open(infile_name,wxFile::read))
419 { 415 {
420 err.Printf(wxT("Could not open: %s"),infile_name.c_str()); 416 ERR_DIALOG(wxT("Could not open: ") + infile_name, wxT("iriver_decode"));
421 ERR_DIALOG(err, wxT("iriver_decode"));
422 return -1; 417 return -1;
423 } 418 }
424 if(!outfile.Open(outfile_name,wxFile::write)) 419 if(!outfile.Open(outfile_name,wxFile::write))
425 { 420 {
426 err.Printf(wxT("Could not open: %s"),outfile_name.c_str()); 421 ERR_DIALOG(wxT("Could not open: ") + outfile_name,
427 ERR_DIALOG(err, wxT("iriver_decode")); 422 wxT("iriver_decode"));
428 return -1; 423 return -1;
429 } 424 }
430 425
@@ -562,14 +557,14 @@ bool PatchFirmware(wxString firmware,wxString bootloader,int series, int table_e
562 break; 557 break;
563 } 558 }
564 559
565 name1.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "firmware.bin"), 560 name1 = gv->stdpaths->GetUserDataDir()
566 gv->stdpaths->GetUserDataDir().c_str()); 561 + wxT("" PATH_SEP "download" PATH_SEP "firmware.bin"),
567 /* descrambled file */ 562 /* descrambled file */
568 name2.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "new.bin"), 563 name2 = gv->stdpaths->GetUserDataDir()
569 gv->stdpaths->GetUserDataDir().c_str()); 564 + wxT("" PATH_SEP "download" PATH_SEP "new.bin");
570 /* patched file */ 565 /* patched file */
571 name3.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "new.hex"), 566 name3 = gv->stdpaths->GetUserDataDir()
572 gv->stdpaths->GetUserDataDir().c_str()); 567 + wxT("" PATH_SEP "download" PATH_SEP "new.hex");
573 if (iriver_decode(firmware, name1, FALSE, STRIP_NONE) == -1) { 568 if (iriver_decode(firmware, name1, FALSE, STRIP_NONE) == -1) {
574 ERR_DIALOG(wxT("Error in descramble"), wxT("Descramble Firmware")); 569 ERR_DIALOG(wxT("Error in descramble"), wxT("Descramble Firmware"));
575 wxRemoveFile(name1); 570 wxRemoveFile(name1);
diff --git a/rbutil/rbutil.cpp b/rbutil/rbutil.cpp
index e778cf404e..d7ee3ed529 100644
--- a/rbutil/rbutil.cpp
+++ b/rbutil/rbutil.cpp
@@ -65,28 +65,28 @@ bool InstallTheme(wxString Themesrc)
65 int pos = Themesrc.Find('/',true); 65 int pos = Themesrc.Find('/',true);
66 wxString themename = Themesrc.SubString(pos+1,Themesrc.Length()); 66 wxString themename = Themesrc.SubString(pos+1,Themesrc.Length());
67 67
68 src.Printf(wxT("%s/%s"), gv->themes_url.c_str(),Themesrc.c_str()); 68 src = gv->themes_url + wxT("/") + Themesrc;
69 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), 69 dest = gv->stdpaths->GetUserDataDir()
70 gv->stdpaths->GetUserDataDir().c_str(),themename.c_str()); 70 + wxT("" PATH_SEP "download" PATH_SEP) + themename;
71 if( DownloadURL(src, dest) ) 71 if( DownloadURL(src, dest) )
72 { 72 {
73 wxRemoveFile(dest); 73 wxRemoveFile(dest);
74 err.Printf(wxT("Unable to download %s"), src.c_str() ); 74 ERR_DIALOG(wxT("Unable to download ") + src, wxT("Install Theme"));
75 ERR_DIALOG(err, wxT("Install Theme"));
76 return false; 75 return false;
77 } 76 }
78 77
79 if(!checkZip(dest)) 78 if(!checkZip(dest))
80 { 79 {
81 err.Printf(wxT("The Zip %s does not contain the correct dir structure"), dest.c_str()); 80 ERR_DIALOG(wxT("The Zip ") + dest
82 ERR_DIALOG(err, wxT("Install Theme")); 81 + wxT(" does not contain the correct dir structure"),
82 wxT("Install Theme"));
83 return false; 83 return false;
84 } 84 }
85 85
86 if(UnzipFile(dest,gv->curdestdir, true)) 86 if(UnzipFile(dest,gv->curdestdir, true))
87 { 87 {
88 err.Printf(wxT("Unable to unzip %s to %s"), dest.c_str(), gv->curdestdir.c_str()); 88 ERR_DIALOG(wxT("Unable to unzip ") + dest + wxT(" to ")
89 ERR_DIALOG(err, wxT("Install Theme")); 89 + gv->curdestdir, wxT("Install Theme"));
90 return false; 90 return false;
91 } 91 }
92 92
@@ -120,7 +120,7 @@ int DownloadURL(wxString src, wxString dest)
120 wxLogVerbose(wxT("=== begin DownloadURL(%s,%s)"), src.c_str(), 120 wxLogVerbose(wxT("=== begin DownloadURL(%s,%s)"), src.c_str(),
121 dest.c_str()); 121 dest.c_str());
122 122
123 buf.Printf(wxT("Fetching %s"), src.c_str()); 123 buf = wxT("Fetching ") + src;
124 wxProgressDialog* progress = new wxProgressDialog(wxT("Downloading"), 124 wxProgressDialog* progress = new wxProgressDialog(wxT("Downloading"),
125 buf, 100, NULL, wxPD_APP_MODAL | 125 buf, 100, NULL, wxPD_APP_MODAL |
126 wxPD_AUTO_HIDE | wxPD_SMOOTH | wxPD_ELAPSED_TIME | 126 wxPD_AUTO_HIDE | wxPD_SMOOTH | wxPD_ELAPSED_TIME |
@@ -174,8 +174,8 @@ int DownloadURL(wxString src, wxString dest)
174 } else 174 } else
175 { 175 {
176 errnum = os->GetLastError(); 176 errnum = os->GetLastError();
177 errstr.Printf(wxT("Can't write to output stream (%s)"), 177 errstr = wxT("Can't write to output stream (")
178 stream_err_str(errnum).c_str() ); 178 + stream_err_str(errnum) + wxT(")");
179 179
180 break; 180 break;
181 } 181 }
@@ -188,8 +188,8 @@ int DownloadURL(wxString src, wxString dest)
188 errnum = 0; 188 errnum = 0;
189 break; 189 break;
190 } 190 }
191 errstr.Printf(wxT("Can't read from input stream (%s)"), 191 errstr = wxT("Can't read from input stream (")
192 stream_err_str(errnum).c_str() ); 192 + stream_err_str(errnum) + wxT(")");
193 } 193 }
194 } 194 }
195 195
@@ -197,8 +197,8 @@ int DownloadURL(wxString src, wxString dest)
197 if (! errnum) 197 if (! errnum)
198 { 198 {
199 errnum = os->GetLastError(); 199 errnum = os->GetLastError();
200 errstr.Printf(wxT("Can't close output file (%s)"), 200 errstr = wxT("Can't close output file (")
201 stream_err_str(errnum).c_str() ); 201 + stream_err_str(errnum) + wxT(")");
202 202
203 input = false; 203 input = false;
204 } 204 }
@@ -208,9 +208,8 @@ int DownloadURL(wxString src, wxString dest)
208 } else 208 } else
209 { 209 {
210 errnum = is->GetLastError(); 210 errnum = is->GetLastError();
211 errstr.Printf(wxT("Can't get input stream size (%s)"), 211 errstr = wxT("Can't get input stream size (")
212 stream_err_str(errnum).c_str() ); 212 + stream_err_str(errnum) + wxT(")");
213
214 } 213 }
215 } else 214 } else
216 { 215 {
@@ -221,8 +220,8 @@ int DownloadURL(wxString src, wxString dest)
221 } else 220 } else
222 { 221 {
223 errnum = os->GetLastError(); 222 errnum = os->GetLastError();
224 errstr.Printf(wxT("Can't create output stream (%s)"), 223 errstr = wxT("Can't create output stream (")
225 stream_err_str(errnum).c_str() ); 224 + stream_err_str(errnum) + wxT(")");
226 } 225 }
227 delete os; 226 delete os;
228 } else 227 } else
@@ -240,14 +239,11 @@ int DownloadURL(wxString src, wxString dest)
240 if (errnum == 0) errnum = 999; 239 if (errnum == 0) errnum = 999;
241 if (input) 240 if (input)
242 { 241 {
243 buf.Printf(wxT("%s reading\n%s"), 242 ERR_DIALOG(errstr + wxT(" reading\n") + src, wxT("Download URL"));
244 errstr.c_str(), src.c_str());
245 ERR_DIALOG(buf, wxT("Download URL"));
246 } else 243 } else
247 { 244 {
248 buf.Printf(wxT("%s writing to download\n/%s"), 245 ERR_DIALOG(errstr + wxT("writing to download\n/") + dest,
249 errstr.c_str(), dest.c_str()); 246 wxT("Download URL"));
250 ERR_DIALOG(buf, wxT("Download URL"));
251 } 247 }
252 248
253 } 249 }
@@ -273,9 +269,9 @@ int UnzipFile(wxString src, wxString destdir, bool isInstall)
273 if (! in_zip->IsOk() ) 269 if (! in_zip->IsOk() )
274 { 270 {
275 errnum = in_zip->GetLastError(); 271 errnum = in_zip->GetLastError();
276 buf.Printf(wxT("Can't open ZIP stream %s for reading (%s)"), 272 ERR_DIALOG(wxT("Can't open ZIP stream ") + src
277 src.c_str(), stream_err_str(errnum).c_str() ); 273 + wxT(" for reading (") + stream_err_str(errnum)
278 ERR_DIALOG(buf, wxT("Unzip File") ); 274 + wxT(")"), wxT("Unzip File") );
279 delete in_zip; 275 delete in_zip;
280 delete in_file; 276 delete in_file;
281 return true; 277 return true;
@@ -285,9 +281,9 @@ int UnzipFile(wxString src, wxString destdir, bool isInstall)
285 if (! in_zip->IsOk() ) 281 if (! in_zip->IsOk() )
286 { 282 {
287 errnum = in_zip->GetLastError(); 283 errnum = in_zip->GetLastError();
288 buf.Printf(wxT("Error Getting total ZIP entries for %s (%s)"), 284 ERR_DIALOG( wxT("Error Getting total ZIP entries for ")
289 src.c_str(), stream_err_str(errnum).c_str() ); 285 + src + wxT(" (") + stream_err_str(errnum) + wxT(")"),
290 ERR_DIALOG(buf, wxT("Unzip File") ); 286 wxT("Unzip File") );
291 delete in_zip; 287 delete in_zip;
292 delete in_file; 288 delete in_file;
293 return true; 289 return true;
@@ -295,9 +291,8 @@ int UnzipFile(wxString src, wxString destdir, bool isInstall)
295 } else 291 } else
296 { 292 {
297 errnum = in_file->GetLastError(); 293 errnum = in_file->GetLastError();
298 buf.Printf(wxT("Can't open %s (%s)"), src.c_str(), 294 ERR_DIALOG(wxT("Can't open ") + src + wxT(" (")
299 stream_err_str(errnum).c_str() ); 295 + stream_err_str(errnum) + wxT(")"), wxT("Unzip File") );
300 ERR_DIALOG(buf, wxT("Unzip File") );
301 delete in_zip; 296 delete in_zip;
302 delete in_file; 297 delete in_file;
303 return true; 298 return true;
@@ -313,8 +308,7 @@ int UnzipFile(wxString src, wxString destdir, bool isInstall)
313 // We're not overly worried if the logging fails 308 // We're not overly worried if the logging fails
314 if (isInstall) 309 if (isInstall)
315 { 310 {
316 buf.Printf(wxT("%s" PATH_SEP UNINSTALL_FILE), destdir.c_str()); 311 log = new InstallLog(destdir + wxT("" PATH_SEP UNINSTALL_FILE));
317 log = new InstallLog(buf);
318 } 312 }
319 313
320 while (! errnum && 314 while (! errnum &&
@@ -323,21 +317,19 @@ int UnzipFile(wxString src, wxString destdir, bool isInstall)
323 317
324 curfile++; 318 curfile++;
325 wxString name = entry->GetName(); 319 wxString name = entry->GetName();
326 progress_msg.Printf(wxT("Unpacking %s"), name.c_str()); 320 progress_msg = wxT("Unpacking ") + name;
327 if (! progress->Update(curfile, progress_msg) ) { 321 if (! progress->Update(curfile, progress_msg) ) {
328 buf.Printf(wxT("Unpacking cancelled by user")); 322 MESG_DIALOG(wxT("Unpacking cancelled by user"));
329 MESG_DIALOG(buf);
330 errnum = 1000; 323 errnum = 1000;
331 break; 324 break;
332 } 325 }
333 326
334 in_str.Printf(wxT("%s" PATH_SEP "%s"), destdir.c_str(), name.c_str()); 327 in_str = destdir + wxT("" PATH_SEP) + name;
335 328
336 if (entry->IsDir() ) { 329 if (entry->IsDir() ) {
337 if (!wxDirExists(in_str) ) { 330 if (!wxDirExists(in_str) ) {
338 if (! wxMkdir(in_str, 0777) ) { 331 if (! wxMkdir(in_str, 0777) ) {
339 buf.Printf(wxT("Unable to create directory %s"), 332 buf = wxT("Unable to create directory ") + in_str;
340 in_str.c_str() );
341 errnum = 100; 333 errnum = 100;
342 break; 334 break;
343 } 335 }
@@ -349,7 +341,7 @@ int UnzipFile(wxString src, wxString destdir, bool isInstall)
349 wxFFileOutputStream* out = new wxFFileOutputStream(in_str); 341 wxFFileOutputStream* out = new wxFFileOutputStream(in_str);
350 if (! out->IsOk() ) 342 if (! out->IsOk() )
351 { 343 {
352 buf.Printf(wxT("Can't open file %s for writing"), in_str.c_str() ); 344 buf = wxT("Can't open file ") + in_str + wxT(" for writing");
353 delete out; 345 delete out;
354 return 100; 346 return 100;
355 } else if (isInstall) 347 } else if (isInstall)
@@ -410,7 +402,7 @@ int Uninstall(const wxString dir, bool isFullUninstall) {
410 if (! isFullUninstall) 402 if (! isFullUninstall)
411 { 403 {
412 404
413 buf.Printf(wxT("%s" PATH_SEP UNINSTALL_FILE), dir.c_str()); 405 buf = dir + wxT("" PATH_SEP UNINSTALL_FILE);
414 log = new InstallLog(buf, false); // Don't create the log 406 log = new InstallLog(buf, false); // Don't create the log
415 FilesToRemove = log->GetInstalledFiles(); 407 FilesToRemove = log->GetInstalledFiles();
416 if (log) delete log; 408 if (log) delete log;
@@ -439,7 +431,7 @@ int Uninstall(const wxString dir, bool isFullUninstall) {
439 431
440 if (isFullUninstall ) 432 if (isFullUninstall )
441 { 433 {
442 buf.Printf(wxT("%s" PATH_SEP ".rockbox"), dir.c_str()); 434 buf = dir + wxT("" PATH_SEP ".rockbox");
443 if (rm_rf(buf) ) 435 if (rm_rf(buf) )
444 { 436 {
445 WARN_DIALOG(wxT("Unable to completely remove Rockbox directory"), 437 WARN_DIALOG(wxT("Unable to completely remove Rockbox directory"),
@@ -473,8 +465,8 @@ int Uninstall(const wxString dir, bool isFullUninstall) {
473 { 465 {
474 if (! wxRemoveFile((*special)[i]) ) 466 if (! wxRemoveFile((*special)[i]) )
475 { 467 {
476 buf.Printf(wxT("Can't delete %s"), (*special)[i].c_str()); 468 WARN_DIALOG(wxT("Can't delete ") + (*special)[i],
477 WARN_DIALOG(buf.c_str(), wxT("Full uninstall")); 469 wxT("Full uninstall"));
478 errflag = true; 470 errflag = true;
479 } 471 }
480 } 472 }
@@ -500,7 +492,7 @@ int Uninstall(const wxString dir, bool isFullUninstall) {
500 } 492 }
501 493
502 wxString* buf2 = new wxString; 494 wxString* buf2 = new wxString;
503 buf.Printf(wxT("%s%s"), dir.c_str() , FilesToRemove->Item(i).c_str() ); 495 buf = dir + FilesToRemove->Item(i);
504 buf2->Format(wxT("Deleting %s"), buf.c_str()); 496 buf2->Format(wxT("Deleting %s"), buf.c_str());
505 497
506 if (! progress->Update((i + 1) * 100 / totalfiles, *buf2) ) 498 if (! progress->Update((i + 1) * 100 / totalfiles, *buf2) )
@@ -514,10 +506,10 @@ int Uninstall(const wxString dir, bool isFullUninstall) {
514 { 506 {
515 // If we're about to attempt to remove .rockbox. delete 507 // If we're about to attempt to remove .rockbox. delete
516 // install data first 508 // install data first
517 buf2->Printf(wxT("%s" PATH_SEP ".rockbox"), dir.c_str() ); 509 *buf2 = dir + wxT("" PATH_SEP ".rockbox");
518 if ( buf.IsSameAs(buf2->c_str()) ) 510 if ( buf.IsSameAs(buf2->c_str()) )
519 { 511 {
520 buf2->Printf(wxT("%s" PATH_SEP UNINSTALL_FILE), dir.c_str()); 512 *buf2 = dir +wxT("" PATH_SEP UNINSTALL_FILE);
521 wxRemoveFile(*buf2); 513 wxRemoveFile(*buf2);
522 } 514 }
523 515
@@ -595,7 +587,7 @@ bool InstallRbutil(wxString dest)
595 bool copied_exe = false, made_rbdir = false; 587 bool copied_exe = false, made_rbdir = false;
596 InstallLog* log; 588 InstallLog* log;
597 589
598 buf.Printf(wxT("%s" PATH_SEP ".rockbox"), dest.c_str() ); 590 buf = dest + wxT("" PATH_SEP ".rockbox");
599 591
600 if (! wxDirExists(buf) ) 592 if (! wxDirExists(buf) )
601 { 593 {
@@ -603,18 +595,17 @@ bool InstallRbutil(wxString dest)
603 made_rbdir = true; 595 made_rbdir = true;
604 } 596 }
605 597
606 buf.Printf(wxT("%s" PATH_SEP UNINSTALL_FILE), dest.c_str() ); 598 buf = dest + wxT("" PATH_SEP UNINSTALL_FILE);
607 log = new InstallLog(buf); 599 log = new InstallLog(buf);
608 if (made_rbdir) log->WriteFile(wxT(".rockbox"), true); 600 if (made_rbdir) log->WriteFile(wxT(".rockbox"), true);
609 601
610 destdir.Printf(wxT("%s" PATH_SEP "RockboxUtility"), dest.c_str()); 602 destdir = dest + wxT("" PATH_SEP "RockboxUtility");
611 if (! wxDirExists(destdir) ) 603 if (! wxDirExists(destdir) )
612 { 604 {
613 if (! wxMkdir(destdir, 0777) ) 605 if (! wxMkdir(destdir, 0777) )
614 { 606 {
615 buf.Printf(wxT("%s (%s)"), 607 WARN_DIALOG( wxT("Unable to create directory for installer (")
616 wxT("Unable to create directory for installer"), destdir.c_str()); 608 + destdir + wxT(")"), wxT("Portable install") );
617 WARN_DIALOG(buf , wxT("Portable install") );
618 return false; 609 return false;
619 } 610 }
620 log->WriteFile(wxT("RockboxUtility"), true); 611 log->WriteFile(wxT("RockboxUtility"), true);
@@ -636,13 +627,13 @@ bool InstallRbutil(wxString dest)
636 copied_exe = true; 627 copied_exe = true;
637 } 628 }
638 629
639 dstr.Printf(wxT("%s" PATH_SEP "%s"), destdir.c_str(), 630 dstr = destdir + wxT("" PATH_SEP)
640 filestocopy[i].AfterLast(PATH_SEP_CHR).c_str()); 631 + filestocopy[i].AfterLast(PATH_SEP_CHR);
641 if (! wxCopyFile(filestocopy[i], dstr) ) 632 if (! wxCopyFile(filestocopy[i], dstr) )
642 { 633 {
643 buf.Printf(wxT("%s (%s -> %s)"), 634 WARN_DIALOG( wxT("Error copying file (")
644 wxT("Error copying file"), filestocopy[i].c_str(), dstr.c_str()); 635 + filestocopy[i].c_str() + wxT(" -> ")
645 WARN_DIALOG(buf, wxT("Portable Install") ); 636 + dstr + wxT(")"), wxT("Portable Install") );
646 return false; 637 return false;
647 } 638 }
648 buf = dstr; 639 buf = dstr;
@@ -652,13 +643,12 @@ bool InstallRbutil(wxString dest)
652 643
653 if (! copied_exe) 644 if (! copied_exe)
654 { 645 {
655 str.Printf(wxT("%s" PATH_SEP EXE_NAME), gv->AppDir.c_str()); 646 str = gv->AppDir + wxT("" PATH_SEP EXE_NAME);
656 dstr.Printf(wxT("%s" PATH_SEP EXE_NAME), destdir.c_str()); 647 dstr = destdir + wxT("" PATH_SEP EXE_NAME);
657 if (! wxCopyFile(str, dstr) ) 648 if (! wxCopyFile(str, dstr) )
658 { 649 {
659 buf.Printf(wxT("Can't copy program binary %s -> %s"), 650 WARN_DIALOG(wxT("Can't copy program binary ")
660 str.c_str(), dstr.c_str() ); 651 + str + wxT(" -> ") + dstr, wxT("Portable Install") );
661 WARN_DIALOG(buf, wxT("Portable Install") );
662 return false; 652 return false;
663 } 653 }
664 buf = dstr; 654 buf = dstr;
@@ -668,13 +658,12 @@ bool InstallRbutil(wxString dest)
668 658
669 // Copy the local ini file so that it knows that it's a portable copy 659 // Copy the local ini file so that it knows that it's a portable copy
670 gv->UserConfig->Flush(); 660 gv->UserConfig->Flush();
671 dstr.Printf(wxT("%s" PATH_SEP "RockboxUtility.cfg"), destdir.c_str()); 661 dstr = destdir + wxT("" PATH_SEP "RockboxUtility.cfg");
672 if (! wxCopyFile(gv->UserConfigFile, dstr) ) 662 if (! wxCopyFile(gv->UserConfigFile, dstr) )
673 { 663 {
674 buf.Printf(wxT("%s (%s -> %s)"), 664 WARN_DIALOG(wxT("Unable to install user config file (")
675 wxT("Unable to install user config file"), gv->UserConfigFile.c_str(), 665 + gv->UserConfigFile + wxT(" -> ") + dstr + wxT(")"),
676 dstr.c_str() ); 666 wxT("Portable Install") );
677 WARN_DIALOG(buf, wxT("Portable Install") );
678 return false; 667 return false;
679 } 668 }
680 buf = dstr; 669 buf = dstr;
@@ -718,7 +707,7 @@ bool rm_rf(wxString file)
718 wxLogVerbose(selected[i]); 707 wxLogVerbose(selected[i]);
719 if (progress != NULL) 708 if (progress != NULL)
720 { 709 {
721 buf.Printf(wxT("Deleting %s"), selected[i].c_str() ); 710 buf = wxT("Deleting ") + selected[i];
722 if (! progress->Update(i, buf)) 711 if (! progress->Update(i, buf))
723 { 712 {
724 WARN_DIALOG(wxT("Cancelled by user"), wxT("Erase Files")); 713 WARN_DIALOG(wxT("Cancelled by user"), wxT("Erase Files"));
@@ -731,23 +720,22 @@ bool rm_rf(wxString file)
731 { 720 {
732 if ((rc = ! wxRmdir(selected[i])) ) 721 if ((rc = ! wxRmdir(selected[i])) )
733 { 722 {
734 buf.Printf(wxT("Can't remove directory %s"),
735 selected[i].c_str());
736 errflag = true; 723 errflag = true;
737 WARN_DIALOG(buf.c_str(), wxT("Erase files")); 724 WARN_DIALOG(wxT("Can't remove directory ") + selected[i],
725 wxT("Erase files"));
738 } 726 }
739 } else if ((rc = ! wxRemoveFile(selected[i])) ) 727 } else if ((rc = ! wxRemoveFile(selected[i])) )
740 { 728 {
741 buf.Printf(wxT("Error deleting file %s"), selected[i].c_str() );
742 errflag = true; 729 errflag = true;
743 WARN_DIALOG(buf.c_str(),wxT("Erase files")); 730 WARN_DIALOG(wxT("Error deleting file ") + selected[i],
731 wxT("Erase files"));
744 } 732 }
745 } 733 }
746 delete progress; 734 delete progress;
747 } else 735 } else
748 { 736 {
749 buf.Printf(wxT("Can't find expected file %s"), file.c_str()); 737 WARN_DIALOG(wxT("Can't find expected file ") + file,
750 WARN_DIALOG(buf.c_str(), wxT("Erase files")); 738 wxT("Erase files"));
751 return true; 739 return true;
752 } 740 }
753 741
diff --git a/rbutil/rbutilApp.cpp b/rbutil/rbutilApp.cpp
index 71e63884fb..a9101e2656 100644
--- a/rbutil/rbutilApp.cpp
+++ b/rbutil/rbutilApp.cpp
@@ -127,13 +127,15 @@ bool rbutilFrmApp::ReadGlobalConfig(rbutilFrm* myFrame)
127 // then in the user config dir (linux ~/) and 127 // then in the user config dir (linux ~/) and
128 // then config dir (linux /etc/ ) 128 // then config dir (linux /etc/ )
129 129
130 buf.Printf(wxT("%s" PATH_SEP "rbutil.ini"), gv->AppDir.c_str() ); 130 buf = gv->AppDir + wxT("" PATH_SEP "rbutil.ini");
131 if (! wxFileExists(buf) ) 131 if (! wxFileExists(buf) )
132 { 132 {
133 buf.Printf(wxT("%s" PATH_SEP ".rbutil" PATH_SEP "rbutil.ini"), gv->stdpaths->GetUserConfigDir().c_str() ); 133 buf = gv->stdpaths->GetUserConfigDir()
134 + wxT("" PATH_SEP ".rbutil" PATH_SEP "rbutil.ini");
134 if (! wxFileExists(buf) ) 135 if (! wxFileExists(buf) )
135 { 136 {
136 buf.Printf(wxT("%s" PATH_SEP "rbutil.ini"), gv->stdpaths->GetConfigDir().c_str() ); 137 buf = gv->stdpaths->GetConfigDir()
138 + wxT("" PATH_SEP "rbutil.ini");
137 } 139 }
138 } 140 }
139 141
@@ -232,8 +234,7 @@ void rbutilFrmApp::ReadUserConfig()
232{ 234{
233 wxString buf, str, stack; 235 wxString buf, str, stack;
234 236
235 buf.Printf(wxT("%s" PATH_SEP "RockboxUtility.cfg"), 237 buf = gv->AppDir + wxT("" PATH_SEP "RockboxUtility.cfg");
236 gv->AppDir.c_str());
237 238
238 if (wxFileExists(buf) ) 239 if (wxFileExists(buf) )
239 { 240 {
@@ -242,8 +243,8 @@ void rbutilFrmApp::ReadUserConfig()
242 else 243 else
243 { 244 {
244 gv->portable = false; 245 gv->portable = false;
245 buf.Printf(wxT("%s" PATH_SEP "%s"), 246 buf = gv->stdpaths->GetUserDataDir()
246 gv->stdpaths->GetUserDataDir().c_str(), wxT("RockboxUtility.cfg")); 247 + wxT("" PATH_SEP "RockboxUtility.cfg");
247 } 248 }
248 249
249 gv->UserConfig = new wxFileConfig(wxEmptyString, wxEmptyString, buf); 250 gv->UserConfig = new wxFileConfig(wxEmptyString, wxEmptyString, buf);
diff --git a/rbutil/rbutilCtrls.cpp b/rbutil/rbutilCtrls.cpp
index f30442c66d..6164c7dcdd 100644
--- a/rbutil/rbutilCtrls.cpp
+++ b/rbutil/rbutilCtrls.cpp
@@ -167,9 +167,9 @@ void ThemeCtrl::setDevice(wxString device)
167 //get correct Themes list 167 //get correct Themes list
168 wxString src,dest,err; 168 wxString src,dest,err;
169 169
170 src.Printf(wxT("%srbutil.php?res=%s"),gv->themes_url.c_str(),m_currentResolution.c_str()); 170 src = gv->themes_url + wxT("rbutil.php?res=") + m_currentResolution;
171 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s.list"), 171 dest = gv->stdpaths->GetUserDataDir() + wxT("" PATH_SEP "download" PATH_SEP)
172 gv->stdpaths->GetUserDataDir().c_str(),m_currentResolution.c_str()); 172 + m_currentResolution + wxT(".list");
173 173
174 if(DownloadURL(src, dest)) 174 if(DownloadURL(src, dest))
175 { 175 {
@@ -249,16 +249,18 @@ void ThemeCtrl::ThemePreview()
249 int pos = m_Themes_image[index].Find('/',true); 249 int pos = m_Themes_image[index].Find('/',true);
250 wxString filename = m_Themes_image[index](pos+1,m_Themes_image[index].Length()); 250 wxString filename = m_Themes_image[index](pos+1,m_Themes_image[index].Length());
251 251
252 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), 252 dest = gv->stdpaths->GetUserDataDir()
253 gv->stdpaths->GetUserDataDir().c_str(),m_currentResolution.c_str()); 253 + wxT("" PATH_SEP "download" PATH_SEP)
254 + m_currentResolution;
254 255
255 if(!wxDirExists(dest)) 256 if(!wxDirExists(dest))
256 wxMkdir(dest); 257 wxMkdir(dest);
257 258
258 //this is a URL no PATH_SEP 259 //this is a URL no PATH_SEP
259 src.Printf(wxT("%s/data/%s/%s"),gv->themes_url.c_str(),m_currentResolution.c_str(),filename.c_str()); 260 src = gv->themes_url + wxT("/data/") + m_currentResolution + wxT("/")
260 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s" PATH_SEP "%s"), 261 + filename;
261 gv->stdpaths->GetUserDataDir().c_str(),m_currentResolution.c_str(),filename.c_str()); 262 dest = gv->stdpaths->GetUserDataDir() + wxT("" PATH_SEP "download" PATH_SEP)
263 + m_currentResolution + wxT("" PATH_SEP) + filename;
262 264
263 if(DownloadURL(src, dest)) 265 if(DownloadURL(src, dest))
264 { 266 {
diff --git a/rbutil/rbutilFrm.cpp b/rbutil/rbutilFrm.cpp
index ce695b03a0..cd68ec86a6 100644
--- a/rbutil/rbutilFrm.cpp
+++ b/rbutil/rbutilFrm.cpp
@@ -336,12 +336,12 @@ void rbutilFrm::OnManualUpdate(wxUpdateUIEvent& event)
336 336
337 // construct link to pdf 337 // construct link to pdf
338 wxString pdflink; 338 wxString pdflink;
339 pdflink.Printf(wxT("%s%s.pdf"),gv->manual_url.c_str(),curManualDevice.c_str()); 339 pdflink = gv->manual_url + curManualDevice + wxT(".pdf");
340 manuallink->SetURL(pdflink); 340 manuallink->SetURL(pdflink);
341 341
342 // construct link to html 342 // construct link to html
343 wxString htmllink; 343 wxString htmllink;
344 htmllink.Printf(wxT("%s%s/rockbox-build.html"),gv->manual_url.c_str(),curManualDevice.c_str()); 344 htmllink = gv->manual_url + curManualDevice + wxT("/rockbox-build.html");
345 if(!manual->LoadPage(htmllink)) 345 if(!manual->LoadPage(htmllink))
346 manual->SetPage(wxT("<p>unable to display manual -- please use the PDF link above</p>")); 346 manual->SetPage(wxT("<p>unable to display manual -- please use the PDF link above</p>"));
347 347
@@ -420,8 +420,7 @@ void rbutilFrm::OnFileWipeCache(wxCommandEvent& event)
420 return; 420 return;
421 } 421 }
422 422
423 cacheloc.Printf(wxT("%s" PATH_SEP "download"), 423 cacheloc = datadir + wxT("" PATH_SEP "download");
424 datadir.c_str());
425 424
426 if (! rm_rf(cacheloc) ) 425 if (! rm_rf(cacheloc) )
427 { 426 {
@@ -659,17 +658,15 @@ void rbutilFrm::OnInstallBtn(wxCommandEvent& event)
659 { 658 {
660 case BUILD_RELEASE: 659 case BUILD_RELEASE:
661 // This is a URL - don't use PATH_SEP 660 // This is a URL - don't use PATH_SEP
662 src.Printf(wxT("%s%s-%s-%s.zip"), 661 src = gv->download_url + gv->prog_name + wxT("-")
663 gv->download_url.c_str(), gv->prog_name.c_str(), 662 + gv->last_release + wxT("-") + gv->curplat + wxT(".zip");
664 gv->last_release.c_str(), gv->curplat.c_str()); 663 dest = gv->stdpaths->GetUserDataDir() + wxT("download" PATH_SEP)
665 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s-%s-%s.zip"), 664 + gv->prog_name + wxT("-") + gv->last_release + wxT("-")
666 gv->stdpaths->GetUserDataDir().c_str(), 665 + gv->curplat + wxT(".zip");
667 gv->prog_name.c_str(), gv->last_release.c_str(),
668 gv->curplat.c_str());
669 break; 666 break;
670 case BUILD_DAILY: 667 case BUILD_DAILY:
671 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "build-info"), 668 dest = gv->stdpaths->GetUserDataDir()
672 gv->stdpaths->GetUserDataDir().c_str()); 669 + PATH_SEP + wxT("download") + PATH_SEP + wxT("build-info");
673 if (DownloadURL(gv->server_conf_url, dest)) { 670 if (DownloadURL(gv->server_conf_url, dest)) {
674 WARN_DIALOG(wxT("Unable to download build status."), 671 WARN_DIALOG(wxT("Unable to download build status."),
675 wxT("Install")); 672 wxT("Install"));
@@ -682,7 +679,7 @@ void rbutilFrm::OnInstallBtn(wxCommandEvent& event)
682 buildinfo->DeleteAll(); 679 buildinfo->DeleteAll();
683 680
684 if (buf.Len() != 8) { 681 if (buf.Len() != 8) {
685 dest.Printf(wxT("Invalid build date: %s"), buf.c_str()); 682 dest = wxT("Invalid build date: ") + buf;
686 WARN_DIALOG(dest, wxT("Install")); 683 WARN_DIALOG(dest, wxT("Install"));
687 buf = wxT(""); 684 buf = wxT("");
688 } 685 }
@@ -696,23 +693,19 @@ void rbutilFrm::OnInstallBtn(wxCommandEvent& event)
696 buf = date.Format(wxT("%Y%m%d")); // yes, we want UTC 693 buf = date.Format(wxT("%Y%m%d")); // yes, we want UTC
697 } 694 }
698 695
699 src.Printf(wxT("%s%s/%s-%s-%s.zip"), 696 src = gv->daily_url + gv->curplat + wxT("/") + gv->prog_name
700 gv->daily_url.c_str(), gv->curplat.c_str(), 697 + wxT("-") + gv->curplat + wxT("-") + buf + wxT(".zip");
701 gv->prog_name.c_str(), gv->curplat.c_str(),
702 buf.c_str() );
703 698
704 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s-%s-%s.zip"), 699 dest = gv->stdpaths->GetUserDataDir() + PATH_SEP wxT("download")
705 gv->stdpaths->GetUserDataDir().c_str(), 700 + gv->prog_name + wxT("-") + gv->curplat + wxT("-")
706 gv->prog_name.c_str(), 701 + buf + wxT(".zip");
707 gv->curplat.c_str(), buf.c_str() );
708 break; 702 break;
709 case BUILD_BLEEDING: 703 case BUILD_BLEEDING:
710 src.Printf(wxT("%s%s/%s.zip"), 704 src = gv->bleeding_url + gv->curplat + wxT("/")
711 gv->bleeding_url.c_str(), gv->curplat.c_str(), 705 + gv->prog_name + wxT(".zip");
712 gv->prog_name.c_str() ); 706 dest = gv->stdpaths->GetUserDataDir()
713 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s.zip"), 707 + PATH_SEP wxT("download") PATH_SEP
714 gv->stdpaths->GetUserDataDir().c_str(), 708 + gv->prog_name + wxT(".zip");
715 gv->prog_name.c_str() );
716 break; 709 break;
717 default: 710 default:
718 ERR_DIALOG(wxT("Something seriously odd has happened."), 711 ERR_DIALOG(wxT("Something seriously odd has happened."),
@@ -726,8 +719,7 @@ void rbutilFrm::OnInstallBtn(wxCommandEvent& event)
726 if ( DownloadURL(src, dest) ) 719 if ( DownloadURL(src, dest) )
727 { 720 {
728 wxRemoveFile(dest); 721 wxRemoveFile(dest);
729 buf.Printf(wxT("Unable to download %s"), src.c_str() ); 722 ERR_DIALOG(wxT("Unable to download ")+src, wxT("Install"));
730 ERR_DIALOG(buf, wxT("Install"));
731 return; 723 return;
732 } 724 }
733 } 725 }
@@ -741,8 +733,7 @@ void rbutilFrm::OnInstallBtn(wxCommandEvent& event)
741 } else 733 } else
742 { 734 {
743 wxRemoveFile(dest); 735 wxRemoveFile(dest);
744 buf.Printf(wxT("Unable to unzip %s"), dest.c_str() ); 736 ERR_DIALOG(wxT("Unable to unzip ")+dest, wxT("Install"));
745 ERR_DIALOG(buf, wxT("Install"));
746 } 737 }
747 738
748 739
@@ -775,17 +766,17 @@ void rbutilFrm::OnFontBtn(wxCommandEvent& event)
775 return; 766 return;
776 767
777 768
778 buf.Printf(wxT("%s" PATH_SEP ".rockbox"), gv->curdestdir.c_str()) ; 769 buf = gv->curdestdir + wxT("" PATH_SEP ".rockbox");
779 if (! wxDirExists(buf) ) 770 if (! wxDirExists(buf) )
780 { 771 {
781 buf.Printf(wxT("Rockbox is not yet installed on %s - install " 772 WARN_DIALOG(wxT("Rockbox is not yet installed on ") + buf
782 "Rockbox first."), buf.c_str() ); 773 + wxT(" - install Rockbox first."),
783 WARN_DIALOG(buf, wxT("Can't install fonts") ); 774 wxT("Can't install fonts") );
784 return; 775 return;
785 } 776 }
786 777
787 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "build-info"), 778 dest = gv->stdpaths->GetUserDataDir()
788 gv->stdpaths->GetUserDataDir().c_str()); 779 + wxT( "" PATH_SEP "download" PATH_SEP "build-info");
789 if (DownloadURL(gv->server_conf_url, dest)) 780 if (DownloadURL(gv->server_conf_url, dest))
790 { 781 {
791 WARN_DIALOG(wxT("Unable to download build status."), 782 WARN_DIALOG(wxT("Unable to download build status."),
@@ -799,8 +790,7 @@ void rbutilFrm::OnFontBtn(wxCommandEvent& event)
799 buildinfo->DeleteAll(); 790 buildinfo->DeleteAll();
800 791
801 if (buf.Len() != 8) { 792 if (buf.Len() != 8) {
802 dest.Printf(wxT("Invalid build date: %s"), buf.c_str()); 793 WARN_DIALOG(wxT("Invalid build date: ") + buf, wxT("Font Install"));
803 WARN_DIALOG(dest, wxT("Font Install"));
804 buf = wxT(""); 794 buf = wxT("");
805 } 795 }
806 } 796 }
@@ -814,19 +804,17 @@ void rbutilFrm::OnFontBtn(wxCommandEvent& event)
814 buf = date.Format(wxT("%Y%m%d")); // yes, we want UTC 804 buf = date.Format(wxT("%Y%m%d")); // yes, we want UTC
815 } 805 }
816 806
817 src.Printf(wxT("%s%s.zip"), gv->font_url.c_str(), buf.c_str() ); 807 src = gv->font_url + buf + wxT(".zip");
818 808
819 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP 809 dest = gv->stdpaths->GetUserDataDir() + wxT( "" PATH_SEP "download"
820 "rockbox-fonts-%s.zip"), gv->stdpaths->GetUserDataDir().c_str(), 810 PATH_SEP "rockbox-fonts-") + buf + wxT(".zip");
821 buf.c_str() );
822 811
823 if ( ! wxFileExists(dest) ) 812 if ( ! wxFileExists(dest) )
824 { 813 {
825 if ( DownloadURL(src, dest) ) 814 if ( DownloadURL(src, dest) )
826 { 815 {
827 wxRemoveFile(dest); 816 wxRemoveFile(dest);
828 buf.Printf(wxT("Unable to download %s"), src.c_str() ); 817 ERR_DIALOG(wxT("Unable to download ") + src, wxT("Font Install"));
829 ERR_DIALOG(buf, wxT("Font Install"));
830 return; 818 return;
831 } 819 }
832 } 820 }
@@ -840,8 +828,7 @@ void rbutilFrm::OnFontBtn(wxCommandEvent& event)
840 } else 828 } else
841 { 829 {
842 wxRemoveFile(dest); 830 wxRemoveFile(dest);
843 buf.Printf(wxT("Unable to unzip %s"), dest.c_str() ); 831 ERR_DIALOG(wxT("Unable to unzip ") + dest, wxT("Font Install"));
844 ERR_DIALOG(buf, wxT("Font Install"));
845 } 832 }
846 833
847 wxLogVerbose(wxT("=== end rbutilFrm::OnFontBtn")); 834 wxLogVerbose(wxT("=== end rbutilFrm::OnFontBtn"));
@@ -867,27 +854,27 @@ void rbutilFrm::OnDoomBtn(wxCommandEvent& event)
867 if(msg.ShowModal() != wxID_OK ) 854 if(msg.ShowModal() != wxID_OK )
868 return; 855 return;
869 856
870 buf.Printf(wxT("%s" PATH_SEP ".rockbox"), gv->curdestdir.c_str()) ; 857 buf = gv->curdestdir + wxT("" PATH_SEP ".rockbox");
871 if (! wxDirExists(buf) ) 858 if (! wxDirExists(buf) )
872 { 859 {
873 buf.Printf(wxT("Rockbox is not yet installed on %s - install " 860 WARN_DIALOG(wxT("Rockbox is not yet installed on ") + buf
874 "Rockbox first."), buf.c_str() ); 861 + wxT(" - install Rockbox first."),
875 WARN_DIALOG(buf, wxT("Can't install freedoom wads") ); 862 wxT("Can't install freedoom wads") );
876 return; 863 return;
877 } 864 }
878 865
879 src = gv->doom_url; 866 src = gv->doom_url;
880 867
881 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP 868 dest = gv->stdpaths->GetUserDataDir() + wxT("" PATH_SEP "download" PATH_SEP
882 "rockdoom.zip"), gv->stdpaths->GetUserDataDir().c_str()); 869 "rockdoom.zip");
883 870
884 if ( ! wxFileExists(dest) ) 871 if ( ! wxFileExists(dest) )
885 { 872 {
886 if ( DownloadURL(src, dest) ) 873 if ( DownloadURL(src, dest) )
887 { 874 {
888 wxRemoveFile(dest); 875 wxRemoveFile(dest);
889 buf.Printf(wxT("Unable to download %s"), src.c_str() ); 876 ERR_DIALOG(wxT("Unable to download ") + src,
890 ERR_DIALOG(buf, wxT("Freedoom Install")); 877 wxT("Freedoom Install"));
891 return; 878 return;
892 } 879 }
893 } 880 }
@@ -901,8 +888,7 @@ void rbutilFrm::OnDoomBtn(wxCommandEvent& event)
901 } else 888 } else
902 { 889 {
903 wxRemoveFile(dest); 890 wxRemoveFile(dest);
904 buf.Printf(wxT("Unable to unzip %s"), dest.c_str() ); 891 ERR_DIALOG(wxT("Unable to unzip ") + dest, wxT("Freedoom Install"));
905 ERR_DIALOG(buf, wxT("Freedoom Install"));
906 } 892 }
907 893
908 894