1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Antoine Cellerier 2007-06-10 22:08:48 +00:00
parent 71eedc7a5b
commit 1bc4ce9a0a
8 changed files with 224 additions and 255 deletions

View file

@ -55,14 +55,14 @@ bool ipodpatcher(int mode,wxString bootloadername)
// downloading files // downloading files
if(mode == BOOTLOADER_ADD) if(mode == BOOTLOADER_ADD)
{ {
src.Printf(wxT("%s/ipod/%s.ipod"),gv->bootloader_url.c_str(),bootloadername.c_str()); src = gv->bootloader_url + wxT("/ipod/")
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), + bootloadername + wxT(".ipod");
gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str()); dest = gv->stdpaths->GetUserDataDir()
+ wxT("" PATH_SEP "download" PATH_SEP) + bootloadername;
if ( DownloadURL(src, dest) ) if ( DownloadURL(src, dest) )
{ {
wxRemoveFile(dest); wxRemoveFile(dest);
buf.Printf(wxT("Unable to download %s"), src.c_str() ); ERR_DIALOG(wxT("Unable to download ") + src, wxT("Install"));
ERR_DIALOG(buf, wxT("Install"));
return false; return false;
} }
} }
@ -191,14 +191,14 @@ bool sansapatcher(int mode,wxString bootloadername)
// downloading files // downloading files
if(mode == BOOTLOADER_ADD) if(mode == BOOTLOADER_ADD)
{ {
src.Printf(wxT("%s/sandisk-sansa/e200/%s"),gv->bootloader_url.c_str(),bootloadername.c_str()); src = gv->bootloader_url + wxT("/sandisk-sansa/e200/")
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), + bootloadername;
gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str()); dest = gv->stdpaths->GetUserDataDir()
+ wxT("" PATH_SEP "download" PATH_SEP) + bootloadername;
if ( DownloadURL(src, dest) ) if ( DownloadURL(src, dest) )
{ {
wxRemoveFile(dest); wxRemoveFile(dest);
buf.Printf(wxT("Unable to download %s"), src.c_str() ); ERR_DIALOG(wxT("Unable to download ") + src, wxT("Download"));
ERR_DIALOG(buf, wxT("Download"));
return false; return false;
} }
} }
@ -270,27 +270,26 @@ bool gigabeatf(int mode,wxString bootloadername,wxString deviceDir)
wxString err; wxString err;
wxString src,dest; wxString src,dest;
path1.Printf(wxT("%s" PATH_SEP "GBSYSTEM" PATH_SEP "FWIMG" PATH_SEP "FWIMG01.DAT"),deviceDir.c_str()); path1 = deviceDir
+ wxT("" PATH_SEP "GBSYSTEM" PATH_SEP "FWIMG" PATH_SEP "FWIMG01.DAT");
if(mode == BOOTLOADER_ADD) if(mode == BOOTLOADER_ADD)
{ {
//Files downloaden //Files downloaden
src.Printf(wxT("%s/gigabeat/%s"), gv->bootloader_url.c_str(),bootloadername.c_str()); src = gv->bootloader_url + wxT("/gigabeat/") + bootloadername;
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), dest = gv->stdpaths->GetUserDataDir()
gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str()); + wxT("" PATH_SEP "download" PATH_SEP) + bootloadername;
if( DownloadURL(src, dest) ) if( DownloadURL(src, dest) )
{ {
wxRemoveFile(dest); wxRemoveFile(dest);
err.Printf(wxT("Unable to download %s"), src.c_str() ); ERR_DIALOG(wxT("Unable to download ") + src, wxT("Install"));
ERR_DIALOG(err, wxT("Install"));
return false; return false;
} }
if(!wxFileExists(path1)) if(!wxFileExists(path1))
{ {
err.Printf(wxT("[ERR] Coud not find %s"),path1.c_str()); ERR_DIALOG(wxT("[ERR] Coud not find ")+path1, wxT("Bootloader add"));
ERR_DIALOG(err, wxT("Bootloader add"));
return false; return false;
} }
path2 = path1; path2 = path1;
@ -299,8 +298,8 @@ bool gigabeatf(int mode,wxString bootloadername,wxString deviceDir)
{ {
if(!wxRenameFile(path1,path2,false)) if(!wxRenameFile(path1,path2,false))
{ {
err.Printf(wxT("[ERR] Coud not rename %s to %s"),path1.c_str(),path2.c_str()); ERR_DIALOG(wxT("[ERR] Coud not rename ") + path1 + wxT(" to ")
ERR_DIALOG(err, wxT("Bootloader add")); + path2, wxT("Bootloader add"));
return false; return false;
} }
} }
@ -308,8 +307,8 @@ bool gigabeatf(int mode,wxString bootloadername,wxString deviceDir)
if(!wxCopyFile(dest,path1)) if(!wxCopyFile(dest,path1))
{ {
err.Printf(wxT("[ERR] Coud not copy %s to %s"),dest.c_str(),path2.c_str()); ERR_DIALOG(wxT("[ERR] Coud not copy ") + dest + wxT(" to ")
ERR_DIALOG(err, wxT("Bootloader add")); + path2, wxT("Bootloader add"));
return false; return false;
} }
} }
@ -319,14 +318,14 @@ bool gigabeatf(int mode,wxString bootloadername,wxString deviceDir)
path2.Append(wxT(".ORIG")); path2.Append(wxT(".ORIG"));
if(!wxFileExists(path2)) if(!wxFileExists(path2))
{ {
err.Printf(wxT("[ERR] Coud not find %s"),path1.c_str()); ERR_DIALOG(wxT("[ERR] Coud not find ") + path1,
ERR_DIALOG(err, wxT("Bootloader del")); wxT("Bootloader del"));
return false; return false;
} }
if(!wxRenameFile(path2,path1,true)) if(!wxRenameFile(path2,path1,true))
{ {
err.Printf(wxT("[ERR] Coud not rename %s to %s"),path1.c_str(),path2.c_str()); ERR_DIALOG(wxT("[ERR] Coud not rename ") + path1 + wxT(" to ")
ERR_DIALOG(err, wxT("Bootloader del")); + path2, wxT("Bootloader del"));
return false; return false;
} }
} }
@ -340,27 +339,27 @@ bool iaudiox5(int mode,wxString bootloadername,wxString deviceDir)
wxString err; wxString err;
wxString src,dest; wxString src,dest;
path1.Printf(wxT("%s" PATH_SEP "FIRMWARE" PATH_SEP "%s"),deviceDir.c_str(),bootloadername.c_str()); path1 = deviceDir + wxT("" PATH_SEP "FIRMWARE" PATH_SEP)
+ bootloadername;
if(mode == BOOTLOADER_ADD) if(mode == BOOTLOADER_ADD)
{ {
//Files downloaden //Files downloaden
src.Printf(wxT("%s/iaudio/%s"),gv->bootloader_url.c_str(),bootloadername.c_str()); src = gv->bootloader_url + wxT("/iaudio/") + bootloadername;
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), dest = gv->stdpaths->GetUserDataDir()
gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str()); + wxT("" PATH_SEP "download" PATH_SEP) + bootloadername;
if( DownloadURL(src, dest) ) if( DownloadURL(src, dest) )
{ {
wxRemoveFile(dest); wxRemoveFile(dest);
err.Printf(wxT("Unable to download %s"), src.c_str() ); ERR_DIALOG(wxT("Unable to download ") + src, wxT("Install"));
ERR_DIALOG(err, wxT("Install"));
return false; return false;
} }
// copy file // copy file
if(!wxCopyFile(dest,path1)) if(!wxCopyFile(dest,path1))
{ {
err.Printf(wxT("[ERR] Coud not copy %s to %s"),dest.c_str(),path2.c_str()); ERR_DIALOG(wxT("[ERR] Coud not copy ")+dest+wxT(" to ")+path2,
ERR_DIALOG(err, wxT("Bootloader add")); wxT("Bootloader add"));
return false; return false;
} }
@ -383,27 +382,26 @@ bool h10(int mode,wxString bootloadername,wxString deviceDir)
if(mode == BOOTLOADER_ADD) if(mode == BOOTLOADER_ADD)
{ {
//Files downloaden //Files downloaden
src.Printf(wxT("%s/iriver/%s"), gv->bootloader_url.c_str(),bootloadername.c_str()); src = gv->bootloader_url + wxT("/iriver/") + bootloadername;
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), dest = gv->stdpaths->GetUserDataDir()
gv->stdpaths->GetUserDataDir().c_str(),firmwarename.c_str()); + wxT("" PATH_SEP "download" PATH_SEP) + firmwarename;
if( DownloadURL(src, dest) ) if( DownloadURL(src, dest) )
{ {
wxRemoveFile(dest); wxRemoveFile(dest);
err.Printf(wxT("Unable to download %s"), src.c_str() ); ERR_DIALOG(wxT("Unable to download ") + src, wxT("Install"));
ERR_DIALOG(err, wxT("Install"));
return false; return false;
} }
path1.Printf(wxT("%sSYSTEM" PATH_SEP "%s"),deviceDir.c_str(),firmwarename.c_str()); path1 = deviceDir + wxT("SYSTEM" PATH_SEP) + firmwarename;
path2.Printf(wxT("%sSYSTEM" PATH_SEP "Original.mi4"),deviceDir.c_str()); path2 = deviceDir + wxT("SYSTEM" PATH_SEP "Original.mi4");
if(!wxFileExists(path1)) //Firmware dosent exists on player if(!wxFileExists(path1)) //Firmware dosent exists on player
{ {
path1.Printf(wxT("%sSYSTEM" PATH_SEP "H10EMP.mi4"),deviceDir.c_str()); //attempt other firmwarename path1 = deviceDir + wxT("SYSTEM" PATH_SEP "H10EMP.mi4"); //attempt other firmwarename
if(!wxFileExists(path1)) //Firmware dosent exists on player if(!wxFileExists(path1)) //Firmware dosent exists on player
{ {
err.Printf(wxT("[ERR] File %s does not Exist"),path1.c_str()); ERR_DIALOG(wxT("[ERR] File ") + path1 + wxT(" does not Exist"),
ERR_DIALOG(err, wxT("Bootloader add")); wxT("Bootloader add"));
return false; return false;
} }
} }
@ -411,16 +409,16 @@ bool h10(int mode,wxString bootloadername,wxString deviceDir)
{ {
if(!wxRenameFile(path1,path2,false)) //rename Firmware to Original if(!wxRenameFile(path1,path2,false)) //rename Firmware to Original
{ {
err.Printf(wxT("[ERR] Coud not rename %s to %s"),path1.c_str(),path2.c_str()); ERR_DIALOG(wxT("[ERR] Coud not rename ") + path1 + wxT(" to ")
ERR_DIALOG(err, wxT("Bootloader add")); + path2, wxT("Bootloader add"));
return false; return false;
} }
} }
if(!wxCopyFile(dest,path1)) // copy file if(!wxCopyFile(dest,path1)) // copy file
{ {
err.Printf(wxT("[ERR] Coud not copy %s to %s"),dest.c_str(),path1.c_str()); ERR_DIALOG(wxT("[ERR] Coud not copy ") + dest + wxT(" to ") + path1,
ERR_DIALOG(err,wxT("Bootloader add")); wxT("Bootloader add"));
return false; return false;
} }
@ -429,30 +427,30 @@ bool h10(int mode,wxString bootloadername,wxString deviceDir)
} }
else if(mode == BOOTLOADER_REM) else if(mode == BOOTLOADER_REM)
{ {
path1.Printf(wxT("%sSYSTEM" PATH_SEP "%s"),deviceDir.c_str(),firmwarename.c_str()); path1 = deviceDir + wxT("SYSTEM" PATH_SEP) + firmwarename;
path2.Printf(wxT("%sSYSTEM" PATH_SEP "Original.mi4"),gv->curdestdir.c_str()); path2 = gv->curdestdir + wxT("SYSTEM" PATH_SEP "Original.mi4");
if(!wxFileExists(path1)) //Firmware dosent exists on player if(!wxFileExists(path1)) //Firmware dosent exists on player
{ {
path1.Printf(wxT("%s" PATH_SEP "SYSTEM" PATH_SEP "H10EMP.mi4"),deviceDir.c_str()); //attempt other firmwarename path1 = deviceDir + wxT("" PATH_SEP "SYSTEM" PATH_SEP "H10EMP.mi4"); //attempt other firmwarename
if(!wxFileExists(path1)) //Firmware dosent exists on player if(!wxFileExists(path1)) //Firmware dosent exists on player
{ {
err.Printf(wxT("[ERR] File %s does not Exist"),path1.c_str()); ERR_DIALOG(wxT("[ERR] File ") + path1 + wxT(" does not Exist"),
ERR_DIALOG(err, wxT("Bootloader rem")); wxT("Bootloader rem"));
return false; return false;
} }
} }
if(!wxFileExists(path2)) //Original Firmware dosent exists on player if(!wxFileExists(path2)) //Original Firmware dosent exists on player
{ {
err.Printf(wxT("[ERR] File %s does not Exist"),path2.c_str()); ERR_DIALOG(wxT("[ERR] File ") + path2 + wxT(" does not Exist"),
ERR_DIALOG(err, wxT("Bootloader rem")); wxT("Bootloader rem"));
return false; return false;
} }
if(!wxRenameFile(path2,path1,true)) //rename Firmware to Original if(!wxRenameFile(path2,path1,true)) //rename Firmware to Original
{ {
err.Printf(wxT("[ERR] Coud not rename %s to %s"),path2.c_str(),path1.c_str()); ERR_DIALOG(wxT("[ERR] Coud not rename ") + path2 + wxT(" to ")
ERR_DIALOG(err, wxT("Bootloader add")); + path1, wxT("Bootloader add"));
return false; return false;
} }
@ -503,38 +501,42 @@ bool fwpatcher(int mode,wxString bootloadername,wxString deviceDir,wxString firm
else else
{ {
//Download bootloader //Download bootloader
src.Printf(wxT("%s/iriver/%s"), gv->bootloader_url.c_str(),bootloadername.c_str()); src = gv->bootloader_url + wxT("/iriver/")
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), + bootloadername;
gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str()); dest = gv->stdpaths->GetUserDataDir()
+ wxT("" PATH_SEP "download" PATH_SEP)
+ bootloadername;
if( DownloadURL(src, dest) ) if( DownloadURL(src, dest) )
{ {
wxRemoveFile(dest); wxRemoveFile(dest);
err.Printf(wxT("Unable to download %s"), src.c_str() ); ERR_DIALOG(wxT("Unable to download ") + src,
ERR_DIALOG(err, wxT("Install")); wxT("Install"));
return false; return false;
} }
if(!PatchFirmware(firmware,dest,series, table_entry)) // Patch firmware if(!PatchFirmware(firmware,dest,series, table_entry)) // Patch firmware
{ {
ERR_DIALOG(wxT("Patching Firmware failed"), wxT("Patching Firmware")); ERR_DIALOG(wxT("Patching Firmware failed"),
wxT("Patching Firmware"));
return false; return false;
} }
} }
// Load patched Firmware to player // Load patched Firmware to player
src.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "new.hex"), src = gv->stdpaths->GetUserDataDir()
gv->stdpaths->GetUserDataDir().c_str()); + wxT("" PATH_SEP "download" PATH_SEP "new.hex");
if(gv->curplat == wxT("h100")) if(gv->curplat == wxT("h100"))
dest.Printf(wxT("%s" PATH_SEP "ihp_100.hex"),deviceDir.c_str()); dest = deviceDir + wxT("" PATH_SEP "ihp_100.hex");
else if(gv->curplat == wxT("h120")) else if(gv->curplat == wxT("h120"))
dest.Printf(wxT("%s" PATH_SEP "ihp_120.hex"),deviceDir.c_str()); dest = deviceDir + wxT("" PATH_SEP "ihp_120.hex");
else if(gv->curplat == wxT("h300")) else if(gv->curplat == wxT("h300"))
dest.Printf(wxT("%s" PATH_SEP "H300.hex"),deviceDir.c_str()); dest = deviceDir + wxT("" PATH_SEP "H300.hex");
if(!wxRenameFile(src,dest)) if(!wxRenameFile(src,dest))
{ {
ERR_DIALOG(wxT("Copying Firmware to Device failed"), wxT("Copying Firmware")); ERR_DIALOG(wxT("Copying Firmware to Device failed"),
wxT("Copying Firmware"));
return false; return false;
} }
else else

View file

@ -528,9 +528,7 @@ void rockboxInstallDlg::CreateControls()
wxBoxSizer3->Add(WxStaticText1,0,wxGROW | wxALL,5); wxBoxSizer3->Add(WxStaticText1,0,wxGROW | wxALL,5);
wxArrayString array; wxArrayString array;
wxString buf; array.Add(wxT("Rockbox stable version (") + gv->last_release + wxT(")"));
buf.Printf(wxT("Rockbox stable version (%s)") , gv->last_release.c_str());
array.Add(buf);
array.Add(wxT("Archived Build")); array.Add(wxT("Archived Build"));
array.Add(wxT("Current Build ")); array.Add(wxT("Current Build "));

View file

@ -33,8 +33,7 @@ InstallLog::InstallLog(wxString logname, bool CreateLog)
if (!logfile) if (!logfile)
{ {
buf.Printf(_("Failed to create install log file: %s"), logname.c_str()); wxLogWarning(_("Failed to create install log file: ") + logname);
wxLogWarning(buf);
return; return;
} }
@ -42,8 +41,7 @@ InstallLog::InstallLog(wxString logname, bool CreateLog)
if (logfile->Exists(wxT("Version")) && if (logfile->Exists(wxT("Version")) &&
logfile->Read(wxT("Version"), 0l) != LOGFILE_VERSION ) logfile->Read(wxT("Version"), 0l) != LOGFILE_VERSION )
{ {
buf.Printf(_("Logfile version mismatch: %s"), logname.c_str() ); wxLogWarning(_("Logfile version mismatch: ") + logname);
wxLogWarning(buf);
delete logfile; delete logfile;
return; return;
} }
@ -122,14 +120,14 @@ void InstallLog::EnumerateCurDir(wxString curdir)
wxString curname, buf, buf2, pathcache; wxString curname, buf, buf2, pathcache;
long dummy; long dummy;
buf.Printf(wxT("/FilePaths/%s"), curdir.c_str()); buf = wxT("/FilePaths/") + curdir;
pathcache = logfile->GetPath(); pathcache = logfile->GetPath();
logfile->SetPath(buf); logfile->SetPath(buf);
contflag = logfile->GetFirstGroup(curname, dummy); contflag = logfile->GetFirstGroup(curname, dummy);
while (contflag) while (contflag)
{ {
buf.Printf(wxT("%s/%s"), curdir.c_str(), curname.c_str() ); buf = curdir + wxT("/") + curname;
buf2 = buf; buf2.Replace(wxT("/"), PATH_SEP); buf2 = buf; buf2.Replace(wxT("/"), PATH_SEP);
workingAS.Add(buf2); workingAS.Add(buf2);
EnumerateCurDir(buf); EnumerateCurDir(buf);
@ -141,9 +139,8 @@ void InstallLog::EnumerateCurDir(wxString curdir)
{ {
if (curname != wxT(DIRECTORY_KLUDGE) ) if (curname != wxT(DIRECTORY_KLUDGE) )
{ {
buf.Printf(wxT("%s/%s"), curdir.c_str(), curname.c_str() ); buf = curdir + wxT("" PATH_SEP) + curname;
buf2 = buf; buf2.Replace(wxT("/"), PATH_SEP); workingAS.Add(buf);
workingAS.Add(buf2);
} }
contflag = logfile->GetNextEntry(curname, dummy); contflag = logfile->GetNextEntry(curname, dummy);
} }

View file

@ -61,8 +61,7 @@ bool mkboot(wxString infile, wxString outfile,wxString bootloader,int origin)
wxFile f; wxFile f;
if(!f.Open(infile)) if(!f.Open(infile))
{ {
err.Printf(wxT("Could not open: %s"),infile.c_str()); ERR_DIALOG(wxT("Could not open: ") + infile, wxT("mkboot"));
ERR_DIALOG(err, wxT("mkboot"));
return false; return false;
} }
i = f.Read(image,16); i = f.Read(image,16);
@ -88,8 +87,7 @@ bool mkboot(wxString infile, wxString outfile,wxString bootloader,int origin)
/* Now, read the boot loader into the image */ /* Now, read the boot loader into the image */
if(!f.Open(bootloader)) if(!f.Open(bootloader))
{ {
err.Printf(wxT("Could not open: %s"),bootloader.c_str()); ERR_DIALOG(wxT("Could not open: ") + bootloader, wxT("mkboot"));
ERR_DIALOG(err, wxT("mkboot"));
return false; return false;
} }
@ -105,8 +103,7 @@ bool mkboot(wxString infile, wxString outfile,wxString bootloader,int origin)
if(!f.Open(outfile,wxFile::write)) if(!f.Open(outfile,wxFile::write))
{ {
err.Printf(wxT("Could not open: %s"),outfile.c_str()); ERR_DIALOG(wxT("Could not open: ") + outfile, wxT("mkboot"));
ERR_DIALOG(err, wxT("mkboot"));
return false; return false;
} }
@ -230,14 +227,13 @@ int iriver_decode(wxString infile_name, wxString outfile_name, unsigned int modi
if(!infile.Open(infile_name)) if(!infile.Open(infile_name))
{ {
err.Printf(wxT("Could not open: %s"),infile_name.c_str()); ERR_DIALOG(wxT("Could not open: ") + infile_name, wxT("iriver_decode"));
ERR_DIALOG(err, wxT("iriver_decode"));
return -1; return -1;
} }
if(!outfile.Open(outfile_name,wxFile::write)) if(!outfile.Open(outfile_name,wxFile::write))
{ {
err.Printf(wxT("Could not open: %s"),outfile_name.c_str()); ERR_DIALOG(wxT("Could not open: ") + outfile_name,
ERR_DIALOG(err, wxT("iriver_decode")); wxT("iriver_decode"));
return -1; return -1;
} }
lenread = infile.Read( headerdata, 512); lenread = infile.Read( headerdata, 512);
@ -417,14 +413,13 @@ int iriver_encode(wxString infile_name, wxString outfile_name, unsigned int modi
if(!infile.Open(infile_name,wxFile::read)) if(!infile.Open(infile_name,wxFile::read))
{ {
err.Printf(wxT("Could not open: %s"),infile_name.c_str()); ERR_DIALOG(wxT("Could not open: ") + infile_name, wxT("iriver_decode"));
ERR_DIALOG(err, wxT("iriver_decode"));
return -1; return -1;
} }
if(!outfile.Open(outfile_name,wxFile::write)) if(!outfile.Open(outfile_name,wxFile::write))
{ {
err.Printf(wxT("Could not open: %s"),outfile_name.c_str()); ERR_DIALOG(wxT("Could not open: ") + outfile_name,
ERR_DIALOG(err, wxT("iriver_decode")); wxT("iriver_decode"));
return -1; return -1;
} }
@ -562,14 +557,14 @@ bool PatchFirmware(wxString firmware,wxString bootloader,int series, int table_e
break; break;
} }
name1.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "firmware.bin"), name1 = gv->stdpaths->GetUserDataDir()
gv->stdpaths->GetUserDataDir().c_str()); + wxT("" PATH_SEP "download" PATH_SEP "firmware.bin"),
/* descrambled file */ /* descrambled file */
name2.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "new.bin"), name2 = gv->stdpaths->GetUserDataDir()
gv->stdpaths->GetUserDataDir().c_str()); + wxT("" PATH_SEP "download" PATH_SEP "new.bin");
/* patched file */ /* patched file */
name3.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "new.hex"), name3 = gv->stdpaths->GetUserDataDir()
gv->stdpaths->GetUserDataDir().c_str()); + wxT("" PATH_SEP "download" PATH_SEP "new.hex");
if (iriver_decode(firmware, name1, FALSE, STRIP_NONE) == -1) { if (iriver_decode(firmware, name1, FALSE, STRIP_NONE) == -1) {
ERR_DIALOG(wxT("Error in descramble"), wxT("Descramble Firmware")); ERR_DIALOG(wxT("Error in descramble"), wxT("Descramble Firmware"));
wxRemoveFile(name1); wxRemoveFile(name1);

View file

@ -65,28 +65,28 @@ bool InstallTheme(wxString Themesrc)
int pos = Themesrc.Find('/',true); int pos = Themesrc.Find('/',true);
wxString themename = Themesrc.SubString(pos+1,Themesrc.Length()); wxString themename = Themesrc.SubString(pos+1,Themesrc.Length());
src.Printf(wxT("%s/%s"), gv->themes_url.c_str(),Themesrc.c_str()); src = gv->themes_url + wxT("/") + Themesrc;
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), dest = gv->stdpaths->GetUserDataDir()
gv->stdpaths->GetUserDataDir().c_str(),themename.c_str()); + wxT("" PATH_SEP "download" PATH_SEP) + themename;
if( DownloadURL(src, dest) ) if( DownloadURL(src, dest) )
{ {
wxRemoveFile(dest); wxRemoveFile(dest);
err.Printf(wxT("Unable to download %s"), src.c_str() ); ERR_DIALOG(wxT("Unable to download ") + src, wxT("Install Theme"));
ERR_DIALOG(err, wxT("Install Theme"));
return false; return false;
} }
if(!checkZip(dest)) if(!checkZip(dest))
{ {
err.Printf(wxT("The Zip %s does not contain the correct dir structure"), dest.c_str()); ERR_DIALOG(wxT("The Zip ") + dest
ERR_DIALOG(err, wxT("Install Theme")); + wxT(" does not contain the correct dir structure"),
wxT("Install Theme"));
return false; return false;
} }
if(UnzipFile(dest,gv->curdestdir, true)) if(UnzipFile(dest,gv->curdestdir, true))
{ {
err.Printf(wxT("Unable to unzip %s to %s"), dest.c_str(), gv->curdestdir.c_str()); ERR_DIALOG(wxT("Unable to unzip ") + dest + wxT(" to ")
ERR_DIALOG(err, wxT("Install Theme")); + gv->curdestdir, wxT("Install Theme"));
return false; return false;
} }
@ -120,7 +120,7 @@ int DownloadURL(wxString src, wxString dest)
wxLogVerbose(wxT("=== begin DownloadURL(%s,%s)"), src.c_str(), wxLogVerbose(wxT("=== begin DownloadURL(%s,%s)"), src.c_str(),
dest.c_str()); dest.c_str());
buf.Printf(wxT("Fetching %s"), src.c_str()); buf = wxT("Fetching ") + src;
wxProgressDialog* progress = new wxProgressDialog(wxT("Downloading"), wxProgressDialog* progress = new wxProgressDialog(wxT("Downloading"),
buf, 100, NULL, wxPD_APP_MODAL | buf, 100, NULL, wxPD_APP_MODAL |
wxPD_AUTO_HIDE | wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_AUTO_HIDE | wxPD_SMOOTH | wxPD_ELAPSED_TIME |
@ -174,8 +174,8 @@ int DownloadURL(wxString src, wxString dest)
} else } else
{ {
errnum = os->GetLastError(); errnum = os->GetLastError();
errstr.Printf(wxT("Can't write to output stream (%s)"), errstr = wxT("Can't write to output stream (")
stream_err_str(errnum).c_str() ); + stream_err_str(errnum) + wxT(")");
break; break;
} }
@ -188,8 +188,8 @@ int DownloadURL(wxString src, wxString dest)
errnum = 0; errnum = 0;
break; break;
} }
errstr.Printf(wxT("Can't read from input stream (%s)"), errstr = wxT("Can't read from input stream (")
stream_err_str(errnum).c_str() ); + stream_err_str(errnum) + wxT(")");
} }
} }
@ -197,8 +197,8 @@ int DownloadURL(wxString src, wxString dest)
if (! errnum) if (! errnum)
{ {
errnum = os->GetLastError(); errnum = os->GetLastError();
errstr.Printf(wxT("Can't close output file (%s)"), errstr = wxT("Can't close output file (")
stream_err_str(errnum).c_str() ); + stream_err_str(errnum) + wxT(")");
input = false; input = false;
} }
@ -208,9 +208,8 @@ int DownloadURL(wxString src, wxString dest)
} else } else
{ {
errnum = is->GetLastError(); errnum = is->GetLastError();
errstr.Printf(wxT("Can't get input stream size (%s)"), errstr = wxT("Can't get input stream size (")
stream_err_str(errnum).c_str() ); + stream_err_str(errnum) + wxT(")");
} }
} else } else
{ {
@ -221,8 +220,8 @@ int DownloadURL(wxString src, wxString dest)
} else } else
{ {
errnum = os->GetLastError(); errnum = os->GetLastError();
errstr.Printf(wxT("Can't create output stream (%s)"), errstr = wxT("Can't create output stream (")
stream_err_str(errnum).c_str() ); + stream_err_str(errnum) + wxT(")");
} }
delete os; delete os;
} else } else
@ -240,14 +239,11 @@ int DownloadURL(wxString src, wxString dest)
if (errnum == 0) errnum = 999; if (errnum == 0) errnum = 999;
if (input) if (input)
{ {
buf.Printf(wxT("%s reading\n%s"), ERR_DIALOG(errstr + wxT(" reading\n") + src, wxT("Download URL"));
errstr.c_str(), src.c_str());
ERR_DIALOG(buf, wxT("Download URL"));
} else } else
{ {
buf.Printf(wxT("%s writing to download\n/%s"), ERR_DIALOG(errstr + wxT("writing to download\n/") + dest,
errstr.c_str(), dest.c_str()); wxT("Download URL"));
ERR_DIALOG(buf, wxT("Download URL"));
} }
} }
@ -273,9 +269,9 @@ int UnzipFile(wxString src, wxString destdir, bool isInstall)
if (! in_zip->IsOk() ) if (! in_zip->IsOk() )
{ {
errnum = in_zip->GetLastError(); errnum = in_zip->GetLastError();
buf.Printf(wxT("Can't open ZIP stream %s for reading (%s)"), ERR_DIALOG(wxT("Can't open ZIP stream ") + src
src.c_str(), stream_err_str(errnum).c_str() ); + wxT(" for reading (") + stream_err_str(errnum)
ERR_DIALOG(buf, wxT("Unzip File") ); + wxT(")"), wxT("Unzip File") );
delete in_zip; delete in_zip;
delete in_file; delete in_file;
return true; return true;
@ -285,9 +281,9 @@ int UnzipFile(wxString src, wxString destdir, bool isInstall)
if (! in_zip->IsOk() ) if (! in_zip->IsOk() )
{ {
errnum = in_zip->GetLastError(); errnum = in_zip->GetLastError();
buf.Printf(wxT("Error Getting total ZIP entries for %s (%s)"), ERR_DIALOG( wxT("Error Getting total ZIP entries for ")
src.c_str(), stream_err_str(errnum).c_str() ); + src + wxT(" (") + stream_err_str(errnum) + wxT(")"),
ERR_DIALOG(buf, wxT("Unzip File") ); wxT("Unzip File") );
delete in_zip; delete in_zip;
delete in_file; delete in_file;
return true; return true;
@ -295,9 +291,8 @@ int UnzipFile(wxString src, wxString destdir, bool isInstall)
} else } else
{ {
errnum = in_file->GetLastError(); errnum = in_file->GetLastError();
buf.Printf(wxT("Can't open %s (%s)"), src.c_str(), ERR_DIALOG(wxT("Can't open ") + src + wxT(" (")
stream_err_str(errnum).c_str() ); + stream_err_str(errnum) + wxT(")"), wxT("Unzip File") );
ERR_DIALOG(buf, wxT("Unzip File") );
delete in_zip; delete in_zip;
delete in_file; delete in_file;
return true; return true;
@ -313,8 +308,7 @@ int UnzipFile(wxString src, wxString destdir, bool isInstall)
// We're not overly worried if the logging fails // We're not overly worried if the logging fails
if (isInstall) if (isInstall)
{ {
buf.Printf(wxT("%s" PATH_SEP UNINSTALL_FILE), destdir.c_str()); log = new InstallLog(destdir + wxT("" PATH_SEP UNINSTALL_FILE));
log = new InstallLog(buf);
} }
while (! errnum && while (! errnum &&
@ -323,21 +317,19 @@ int UnzipFile(wxString src, wxString destdir, bool isInstall)
curfile++; curfile++;
wxString name = entry->GetName(); wxString name = entry->GetName();
progress_msg.Printf(wxT("Unpacking %s"), name.c_str()); progress_msg = wxT("Unpacking ") + name;
if (! progress->Update(curfile, progress_msg) ) { if (! progress->Update(curfile, progress_msg) ) {
buf.Printf(wxT("Unpacking cancelled by user")); MESG_DIALOG(wxT("Unpacking cancelled by user"));
MESG_DIALOG(buf);
errnum = 1000; errnum = 1000;
break; break;
} }
in_str.Printf(wxT("%s" PATH_SEP "%s"), destdir.c_str(), name.c_str()); in_str = destdir + wxT("" PATH_SEP) + name;
if (entry->IsDir() ) { if (entry->IsDir() ) {
if (!wxDirExists(in_str) ) { if (!wxDirExists(in_str) ) {
if (! wxMkdir(in_str, 0777) ) { if (! wxMkdir(in_str, 0777) ) {
buf.Printf(wxT("Unable to create directory %s"), buf = wxT("Unable to create directory ") + in_str;
in_str.c_str() );
errnum = 100; errnum = 100;
break; break;
} }
@ -349,7 +341,7 @@ int UnzipFile(wxString src, wxString destdir, bool isInstall)
wxFFileOutputStream* out = new wxFFileOutputStream(in_str); wxFFileOutputStream* out = new wxFFileOutputStream(in_str);
if (! out->IsOk() ) if (! out->IsOk() )
{ {
buf.Printf(wxT("Can't open file %s for writing"), in_str.c_str() ); buf = wxT("Can't open file ") + in_str + wxT(" for writing");
delete out; delete out;
return 100; return 100;
} else if (isInstall) } else if (isInstall)
@ -410,7 +402,7 @@ int Uninstall(const wxString dir, bool isFullUninstall) {
if (! isFullUninstall) if (! isFullUninstall)
{ {
buf.Printf(wxT("%s" PATH_SEP UNINSTALL_FILE), dir.c_str()); buf = dir + wxT("" PATH_SEP UNINSTALL_FILE);
log = new InstallLog(buf, false); // Don't create the log log = new InstallLog(buf, false); // Don't create the log
FilesToRemove = log->GetInstalledFiles(); FilesToRemove = log->GetInstalledFiles();
if (log) delete log; if (log) delete log;
@ -439,7 +431,7 @@ int Uninstall(const wxString dir, bool isFullUninstall) {
if (isFullUninstall ) if (isFullUninstall )
{ {
buf.Printf(wxT("%s" PATH_SEP ".rockbox"), dir.c_str()); buf = dir + wxT("" PATH_SEP ".rockbox");
if (rm_rf(buf) ) if (rm_rf(buf) )
{ {
WARN_DIALOG(wxT("Unable to completely remove Rockbox directory"), WARN_DIALOG(wxT("Unable to completely remove Rockbox directory"),
@ -473,8 +465,8 @@ int Uninstall(const wxString dir, bool isFullUninstall) {
{ {
if (! wxRemoveFile((*special)[i]) ) if (! wxRemoveFile((*special)[i]) )
{ {
buf.Printf(wxT("Can't delete %s"), (*special)[i].c_str()); WARN_DIALOG(wxT("Can't delete ") + (*special)[i],
WARN_DIALOG(buf.c_str(), wxT("Full uninstall")); wxT("Full uninstall"));
errflag = true; errflag = true;
} }
} }
@ -500,7 +492,7 @@ int Uninstall(const wxString dir, bool isFullUninstall) {
} }
wxString* buf2 = new wxString; wxString* buf2 = new wxString;
buf.Printf(wxT("%s%s"), dir.c_str() , FilesToRemove->Item(i).c_str() ); buf = dir + FilesToRemove->Item(i);
buf2->Format(wxT("Deleting %s"), buf.c_str()); buf2->Format(wxT("Deleting %s"), buf.c_str());
if (! progress->Update((i + 1) * 100 / totalfiles, *buf2) ) if (! progress->Update((i + 1) * 100 / totalfiles, *buf2) )
@ -514,10 +506,10 @@ int Uninstall(const wxString dir, bool isFullUninstall) {
{ {
// If we're about to attempt to remove .rockbox. delete // If we're about to attempt to remove .rockbox. delete
// install data first // install data first
buf2->Printf(wxT("%s" PATH_SEP ".rockbox"), dir.c_str() ); *buf2 = dir + wxT("" PATH_SEP ".rockbox");
if ( buf.IsSameAs(buf2->c_str()) ) if ( buf.IsSameAs(buf2->c_str()) )
{ {
buf2->Printf(wxT("%s" PATH_SEP UNINSTALL_FILE), dir.c_str()); *buf2 = dir +wxT("" PATH_SEP UNINSTALL_FILE);
wxRemoveFile(*buf2); wxRemoveFile(*buf2);
} }
@ -595,7 +587,7 @@ bool InstallRbutil(wxString dest)
bool copied_exe = false, made_rbdir = false; bool copied_exe = false, made_rbdir = false;
InstallLog* log; InstallLog* log;
buf.Printf(wxT("%s" PATH_SEP ".rockbox"), dest.c_str() ); buf = dest + wxT("" PATH_SEP ".rockbox");
if (! wxDirExists(buf) ) if (! wxDirExists(buf) )
{ {
@ -603,18 +595,17 @@ bool InstallRbutil(wxString dest)
made_rbdir = true; made_rbdir = true;
} }
buf.Printf(wxT("%s" PATH_SEP UNINSTALL_FILE), dest.c_str() ); buf = dest + wxT("" PATH_SEP UNINSTALL_FILE);
log = new InstallLog(buf); log = new InstallLog(buf);
if (made_rbdir) log->WriteFile(wxT(".rockbox"), true); if (made_rbdir) log->WriteFile(wxT(".rockbox"), true);
destdir.Printf(wxT("%s" PATH_SEP "RockboxUtility"), dest.c_str()); destdir = dest + wxT("" PATH_SEP "RockboxUtility");
if (! wxDirExists(destdir) ) if (! wxDirExists(destdir) )
{ {
if (! wxMkdir(destdir, 0777) ) if (! wxMkdir(destdir, 0777) )
{ {
buf.Printf(wxT("%s (%s)"), WARN_DIALOG( wxT("Unable to create directory for installer (")
wxT("Unable to create directory for installer"), destdir.c_str()); + destdir + wxT(")"), wxT("Portable install") );
WARN_DIALOG(buf , wxT("Portable install") );
return false; return false;
} }
log->WriteFile(wxT("RockboxUtility"), true); log->WriteFile(wxT("RockboxUtility"), true);
@ -636,13 +627,13 @@ bool InstallRbutil(wxString dest)
copied_exe = true; copied_exe = true;
} }
dstr.Printf(wxT("%s" PATH_SEP "%s"), destdir.c_str(), dstr = destdir + wxT("" PATH_SEP)
filestocopy[i].AfterLast(PATH_SEP_CHR).c_str()); + filestocopy[i].AfterLast(PATH_SEP_CHR);
if (! wxCopyFile(filestocopy[i], dstr) ) if (! wxCopyFile(filestocopy[i], dstr) )
{ {
buf.Printf(wxT("%s (%s -> %s)"), WARN_DIALOG( wxT("Error copying file (")
wxT("Error copying file"), filestocopy[i].c_str(), dstr.c_str()); + filestocopy[i].c_str() + wxT(" -> ")
WARN_DIALOG(buf, wxT("Portable Install") ); + dstr + wxT(")"), wxT("Portable Install") );
return false; return false;
} }
buf = dstr; buf = dstr;
@ -652,13 +643,12 @@ bool InstallRbutil(wxString dest)
if (! copied_exe) if (! copied_exe)
{ {
str.Printf(wxT("%s" PATH_SEP EXE_NAME), gv->AppDir.c_str()); str = gv->AppDir + wxT("" PATH_SEP EXE_NAME);
dstr.Printf(wxT("%s" PATH_SEP EXE_NAME), destdir.c_str()); dstr = destdir + wxT("" PATH_SEP EXE_NAME);
if (! wxCopyFile(str, dstr) ) if (! wxCopyFile(str, dstr) )
{ {
buf.Printf(wxT("Can't copy program binary %s -> %s"), WARN_DIALOG(wxT("Can't copy program binary ")
str.c_str(), dstr.c_str() ); + str + wxT(" -> ") + dstr, wxT("Portable Install") );
WARN_DIALOG(buf, wxT("Portable Install") );
return false; return false;
} }
buf = dstr; buf = dstr;
@ -668,13 +658,12 @@ bool InstallRbutil(wxString dest)
// Copy the local ini file so that it knows that it's a portable copy // Copy the local ini file so that it knows that it's a portable copy
gv->UserConfig->Flush(); gv->UserConfig->Flush();
dstr.Printf(wxT("%s" PATH_SEP "RockboxUtility.cfg"), destdir.c_str()); dstr = destdir + wxT("" PATH_SEP "RockboxUtility.cfg");
if (! wxCopyFile(gv->UserConfigFile, dstr) ) if (! wxCopyFile(gv->UserConfigFile, dstr) )
{ {
buf.Printf(wxT("%s (%s -> %s)"), WARN_DIALOG(wxT("Unable to install user config file (")
wxT("Unable to install user config file"), gv->UserConfigFile.c_str(), + gv->UserConfigFile + wxT(" -> ") + dstr + wxT(")"),
dstr.c_str() ); wxT("Portable Install") );
WARN_DIALOG(buf, wxT("Portable Install") );
return false; return false;
} }
buf = dstr; buf = dstr;
@ -718,7 +707,7 @@ bool rm_rf(wxString file)
wxLogVerbose(selected[i]); wxLogVerbose(selected[i]);
if (progress != NULL) if (progress != NULL)
{ {
buf.Printf(wxT("Deleting %s"), selected[i].c_str() ); buf = wxT("Deleting ") + selected[i];
if (! progress->Update(i, buf)) if (! progress->Update(i, buf))
{ {
WARN_DIALOG(wxT("Cancelled by user"), wxT("Erase Files")); WARN_DIALOG(wxT("Cancelled by user"), wxT("Erase Files"));
@ -731,23 +720,22 @@ bool rm_rf(wxString file)
{ {
if ((rc = ! wxRmdir(selected[i])) ) if ((rc = ! wxRmdir(selected[i])) )
{ {
buf.Printf(wxT("Can't remove directory %s"),
selected[i].c_str());
errflag = true; errflag = true;
WARN_DIALOG(buf.c_str(), wxT("Erase files")); WARN_DIALOG(wxT("Can't remove directory ") + selected[i],
wxT("Erase files"));
} }
} else if ((rc = ! wxRemoveFile(selected[i])) ) } else if ((rc = ! wxRemoveFile(selected[i])) )
{ {
buf.Printf(wxT("Error deleting file %s"), selected[i].c_str() );
errflag = true; errflag = true;
WARN_DIALOG(buf.c_str(),wxT("Erase files")); WARN_DIALOG(wxT("Error deleting file ") + selected[i],
wxT("Erase files"));
} }
} }
delete progress; delete progress;
} else } else
{ {
buf.Printf(wxT("Can't find expected file %s"), file.c_str()); WARN_DIALOG(wxT("Can't find expected file ") + file,
WARN_DIALOG(buf.c_str(), wxT("Erase files")); wxT("Erase files"));
return true; return true;
} }

View file

@ -127,13 +127,15 @@ bool rbutilFrmApp::ReadGlobalConfig(rbutilFrm* myFrame)
// then in the user config dir (linux ~/) and // then in the user config dir (linux ~/) and
// then config dir (linux /etc/ ) // then config dir (linux /etc/ )
buf.Printf(wxT("%s" PATH_SEP "rbutil.ini"), gv->AppDir.c_str() ); buf = gv->AppDir + wxT("" PATH_SEP "rbutil.ini");
if (! wxFileExists(buf) ) if (! wxFileExists(buf) )
{ {
buf.Printf(wxT("%s" PATH_SEP ".rbutil" PATH_SEP "rbutil.ini"), gv->stdpaths->GetUserConfigDir().c_str() ); buf = gv->stdpaths->GetUserConfigDir()
+ wxT("" PATH_SEP ".rbutil" PATH_SEP "rbutil.ini");
if (! wxFileExists(buf) ) if (! wxFileExists(buf) )
{ {
buf.Printf(wxT("%s" PATH_SEP "rbutil.ini"), gv->stdpaths->GetConfigDir().c_str() ); buf = gv->stdpaths->GetConfigDir()
+ wxT("" PATH_SEP "rbutil.ini");
} }
} }
@ -232,8 +234,7 @@ void rbutilFrmApp::ReadUserConfig()
{ {
wxString buf, str, stack; wxString buf, str, stack;
buf.Printf(wxT("%s" PATH_SEP "RockboxUtility.cfg"), buf = gv->AppDir + wxT("" PATH_SEP "RockboxUtility.cfg");
gv->AppDir.c_str());
if (wxFileExists(buf) ) if (wxFileExists(buf) )
{ {
@ -242,8 +243,8 @@ void rbutilFrmApp::ReadUserConfig()
else else
{ {
gv->portable = false; gv->portable = false;
buf.Printf(wxT("%s" PATH_SEP "%s"), buf = gv->stdpaths->GetUserDataDir()
gv->stdpaths->GetUserDataDir().c_str(), wxT("RockboxUtility.cfg")); + wxT("" PATH_SEP "RockboxUtility.cfg");
} }
gv->UserConfig = new wxFileConfig(wxEmptyString, wxEmptyString, buf); gv->UserConfig = new wxFileConfig(wxEmptyString, wxEmptyString, buf);

View file

@ -167,9 +167,9 @@ void ThemeCtrl::setDevice(wxString device)
//get correct Themes list //get correct Themes list
wxString src,dest,err; wxString src,dest,err;
src.Printf(wxT("%srbutil.php?res=%s"),gv->themes_url.c_str(),m_currentResolution.c_str()); src = gv->themes_url + wxT("rbutil.php?res=") + m_currentResolution;
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s.list"), dest = gv->stdpaths->GetUserDataDir() + wxT("" PATH_SEP "download" PATH_SEP)
gv->stdpaths->GetUserDataDir().c_str(),m_currentResolution.c_str()); + m_currentResolution + wxT(".list");
if(DownloadURL(src, dest)) if(DownloadURL(src, dest))
{ {
@ -249,16 +249,18 @@ void ThemeCtrl::ThemePreview()
int pos = m_Themes_image[index].Find('/',true); int pos = m_Themes_image[index].Find('/',true);
wxString filename = m_Themes_image[index](pos+1,m_Themes_image[index].Length()); wxString filename = m_Themes_image[index](pos+1,m_Themes_image[index].Length());
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"), dest = gv->stdpaths->GetUserDataDir()
gv->stdpaths->GetUserDataDir().c_str(),m_currentResolution.c_str()); + wxT("" PATH_SEP "download" PATH_SEP)
+ m_currentResolution;
if(!wxDirExists(dest)) if(!wxDirExists(dest))
wxMkdir(dest); wxMkdir(dest);
//this is a URL no PATH_SEP //this is a URL no PATH_SEP
src.Printf(wxT("%s/data/%s/%s"),gv->themes_url.c_str(),m_currentResolution.c_str(),filename.c_str()); src = gv->themes_url + wxT("/data/") + m_currentResolution + wxT("/")
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s" PATH_SEP "%s"), + filename;
gv->stdpaths->GetUserDataDir().c_str(),m_currentResolution.c_str(),filename.c_str()); dest = gv->stdpaths->GetUserDataDir() + wxT("" PATH_SEP "download" PATH_SEP)
+ m_currentResolution + wxT("" PATH_SEP) + filename;
if(DownloadURL(src, dest)) if(DownloadURL(src, dest))
{ {

View file

@ -336,12 +336,12 @@ void rbutilFrm::OnManualUpdate(wxUpdateUIEvent& event)
// construct link to pdf // construct link to pdf
wxString pdflink; wxString pdflink;
pdflink.Printf(wxT("%s%s.pdf"),gv->manual_url.c_str(),curManualDevice.c_str()); pdflink = gv->manual_url + curManualDevice + wxT(".pdf");
manuallink->SetURL(pdflink); manuallink->SetURL(pdflink);
// construct link to html // construct link to html
wxString htmllink; wxString htmllink;
htmllink.Printf(wxT("%s%s/rockbox-build.html"),gv->manual_url.c_str(),curManualDevice.c_str()); htmllink = gv->manual_url + curManualDevice + wxT("/rockbox-build.html");
if(!manual->LoadPage(htmllink)) if(!manual->LoadPage(htmllink))
manual->SetPage(wxT("<p>unable to display manual -- please use the PDF link above</p>")); manual->SetPage(wxT("<p>unable to display manual -- please use the PDF link above</p>"));
@ -420,8 +420,7 @@ void rbutilFrm::OnFileWipeCache(wxCommandEvent& event)
return; return;
} }
cacheloc.Printf(wxT("%s" PATH_SEP "download"), cacheloc = datadir + wxT("" PATH_SEP "download");
datadir.c_str());
if (! rm_rf(cacheloc) ) if (! rm_rf(cacheloc) )
{ {
@ -659,17 +658,15 @@ void rbutilFrm::OnInstallBtn(wxCommandEvent& event)
{ {
case BUILD_RELEASE: case BUILD_RELEASE:
// This is a URL - don't use PATH_SEP // This is a URL - don't use PATH_SEP
src.Printf(wxT("%s%s-%s-%s.zip"), src = gv->download_url + gv->prog_name + wxT("-")
gv->download_url.c_str(), gv->prog_name.c_str(), + gv->last_release + wxT("-") + gv->curplat + wxT(".zip");
gv->last_release.c_str(), gv->curplat.c_str()); dest = gv->stdpaths->GetUserDataDir() + wxT("download" PATH_SEP)
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s-%s-%s.zip"), + gv->prog_name + wxT("-") + gv->last_release + wxT("-")
gv->stdpaths->GetUserDataDir().c_str(), + gv->curplat + wxT(".zip");
gv->prog_name.c_str(), gv->last_release.c_str(),
gv->curplat.c_str());
break; break;
case BUILD_DAILY: case BUILD_DAILY:
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "build-info"), dest = gv->stdpaths->GetUserDataDir()
gv->stdpaths->GetUserDataDir().c_str()); + PATH_SEP + wxT("download") + PATH_SEP + wxT("build-info");
if (DownloadURL(gv->server_conf_url, dest)) { if (DownloadURL(gv->server_conf_url, dest)) {
WARN_DIALOG(wxT("Unable to download build status."), WARN_DIALOG(wxT("Unable to download build status."),
wxT("Install")); wxT("Install"));
@ -682,7 +679,7 @@ void rbutilFrm::OnInstallBtn(wxCommandEvent& event)
buildinfo->DeleteAll(); buildinfo->DeleteAll();
if (buf.Len() != 8) { if (buf.Len() != 8) {
dest.Printf(wxT("Invalid build date: %s"), buf.c_str()); dest = wxT("Invalid build date: ") + buf;
WARN_DIALOG(dest, wxT("Install")); WARN_DIALOG(dest, wxT("Install"));
buf = wxT(""); buf = wxT("");
} }
@ -696,23 +693,19 @@ void rbutilFrm::OnInstallBtn(wxCommandEvent& event)
buf = date.Format(wxT("%Y%m%d")); // yes, we want UTC buf = date.Format(wxT("%Y%m%d")); // yes, we want UTC
} }
src.Printf(wxT("%s%s/%s-%s-%s.zip"), src = gv->daily_url + gv->curplat + wxT("/") + gv->prog_name
gv->daily_url.c_str(), gv->curplat.c_str(), + wxT("-") + gv->curplat + wxT("-") + buf + wxT(".zip");
gv->prog_name.c_str(), gv->curplat.c_str(),
buf.c_str() );
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s-%s-%s.zip"), dest = gv->stdpaths->GetUserDataDir() + PATH_SEP wxT("download")
gv->stdpaths->GetUserDataDir().c_str(), + gv->prog_name + wxT("-") + gv->curplat + wxT("-")
gv->prog_name.c_str(), + buf + wxT(".zip");
gv->curplat.c_str(), buf.c_str() );
break; break;
case BUILD_BLEEDING: case BUILD_BLEEDING:
src.Printf(wxT("%s%s/%s.zip"), src = gv->bleeding_url + gv->curplat + wxT("/")
gv->bleeding_url.c_str(), gv->curplat.c_str(), + gv->prog_name + wxT(".zip");
gv->prog_name.c_str() ); dest = gv->stdpaths->GetUserDataDir()
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s.zip"), + PATH_SEP wxT("download") PATH_SEP
gv->stdpaths->GetUserDataDir().c_str(), + gv->prog_name + wxT(".zip");
gv->prog_name.c_str() );
break; break;
default: default:
ERR_DIALOG(wxT("Something seriously odd has happened."), ERR_DIALOG(wxT("Something seriously odd has happened."),
@ -726,8 +719,7 @@ void rbutilFrm::OnInstallBtn(wxCommandEvent& event)
if ( DownloadURL(src, dest) ) if ( DownloadURL(src, dest) )
{ {
wxRemoveFile(dest); wxRemoveFile(dest);
buf.Printf(wxT("Unable to download %s"), src.c_str() ); ERR_DIALOG(wxT("Unable to download ")+src, wxT("Install"));
ERR_DIALOG(buf, wxT("Install"));
return; return;
} }
} }
@ -741,8 +733,7 @@ void rbutilFrm::OnInstallBtn(wxCommandEvent& event)
} else } else
{ {
wxRemoveFile(dest); wxRemoveFile(dest);
buf.Printf(wxT("Unable to unzip %s"), dest.c_str() ); ERR_DIALOG(wxT("Unable to unzip ")+dest, wxT("Install"));
ERR_DIALOG(buf, wxT("Install"));
} }
@ -775,17 +766,17 @@ void rbutilFrm::OnFontBtn(wxCommandEvent& event)
return; return;
buf.Printf(wxT("%s" PATH_SEP ".rockbox"), gv->curdestdir.c_str()) ; buf = gv->curdestdir + wxT("" PATH_SEP ".rockbox");
if (! wxDirExists(buf) ) if (! wxDirExists(buf) )
{ {
buf.Printf(wxT("Rockbox is not yet installed on %s - install " WARN_DIALOG(wxT("Rockbox is not yet installed on ") + buf
"Rockbox first."), buf.c_str() ); + wxT(" - install Rockbox first."),
WARN_DIALOG(buf, wxT("Can't install fonts") ); wxT("Can't install fonts") );
return; return;
} }
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "build-info"), dest = gv->stdpaths->GetUserDataDir()
gv->stdpaths->GetUserDataDir().c_str()); + wxT( "" PATH_SEP "download" PATH_SEP "build-info");
if (DownloadURL(gv->server_conf_url, dest)) if (DownloadURL(gv->server_conf_url, dest))
{ {
WARN_DIALOG(wxT("Unable to download build status."), WARN_DIALOG(wxT("Unable to download build status."),
@ -799,8 +790,7 @@ void rbutilFrm::OnFontBtn(wxCommandEvent& event)
buildinfo->DeleteAll(); buildinfo->DeleteAll();
if (buf.Len() != 8) { if (buf.Len() != 8) {
dest.Printf(wxT("Invalid build date: %s"), buf.c_str()); WARN_DIALOG(wxT("Invalid build date: ") + buf, wxT("Font Install"));
WARN_DIALOG(dest, wxT("Font Install"));
buf = wxT(""); buf = wxT("");
} }
} }
@ -814,19 +804,17 @@ void rbutilFrm::OnFontBtn(wxCommandEvent& event)
buf = date.Format(wxT("%Y%m%d")); // yes, we want UTC buf = date.Format(wxT("%Y%m%d")); // yes, we want UTC
} }
src.Printf(wxT("%s%s.zip"), gv->font_url.c_str(), buf.c_str() ); src = gv->font_url + buf + wxT(".zip");
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP dest = gv->stdpaths->GetUserDataDir() + wxT( "" PATH_SEP "download"
"rockbox-fonts-%s.zip"), gv->stdpaths->GetUserDataDir().c_str(), PATH_SEP "rockbox-fonts-") + buf + wxT(".zip");
buf.c_str() );
if ( ! wxFileExists(dest) ) if ( ! wxFileExists(dest) )
{ {
if ( DownloadURL(src, dest) ) if ( DownloadURL(src, dest) )
{ {
wxRemoveFile(dest); wxRemoveFile(dest);
buf.Printf(wxT("Unable to download %s"), src.c_str() ); ERR_DIALOG(wxT("Unable to download ") + src, wxT("Font Install"));
ERR_DIALOG(buf, wxT("Font Install"));
return; return;
} }
} }
@ -840,8 +828,7 @@ void rbutilFrm::OnFontBtn(wxCommandEvent& event)
} else } else
{ {
wxRemoveFile(dest); wxRemoveFile(dest);
buf.Printf(wxT("Unable to unzip %s"), dest.c_str() ); ERR_DIALOG(wxT("Unable to unzip ") + dest, wxT("Font Install"));
ERR_DIALOG(buf, wxT("Font Install"));
} }
wxLogVerbose(wxT("=== end rbutilFrm::OnFontBtn")); wxLogVerbose(wxT("=== end rbutilFrm::OnFontBtn"));
@ -867,27 +854,27 @@ void rbutilFrm::OnDoomBtn(wxCommandEvent& event)
if(msg.ShowModal() != wxID_OK ) if(msg.ShowModal() != wxID_OK )
return; return;
buf.Printf(wxT("%s" PATH_SEP ".rockbox"), gv->curdestdir.c_str()) ; buf = gv->curdestdir + wxT("" PATH_SEP ".rockbox");
if (! wxDirExists(buf) ) if (! wxDirExists(buf) )
{ {
buf.Printf(wxT("Rockbox is not yet installed on %s - install " WARN_DIALOG(wxT("Rockbox is not yet installed on ") + buf
"Rockbox first."), buf.c_str() ); + wxT(" - install Rockbox first."),
WARN_DIALOG(buf, wxT("Can't install freedoom wads") ); wxT("Can't install freedoom wads") );
return; return;
} }
src = gv->doom_url; src = gv->doom_url;
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP dest = gv->stdpaths->GetUserDataDir() + wxT("" PATH_SEP "download" PATH_SEP
"rockdoom.zip"), gv->stdpaths->GetUserDataDir().c_str()); "rockdoom.zip");
if ( ! wxFileExists(dest) ) if ( ! wxFileExists(dest) )
{ {
if ( DownloadURL(src, dest) ) if ( DownloadURL(src, dest) )
{ {
wxRemoveFile(dest); wxRemoveFile(dest);
buf.Printf(wxT("Unable to download %s"), src.c_str() ); ERR_DIALOG(wxT("Unable to download ") + src,
ERR_DIALOG(buf, wxT("Freedoom Install")); wxT("Freedoom Install"));
return; return;
} }
} }
@ -901,8 +888,7 @@ void rbutilFrm::OnDoomBtn(wxCommandEvent& event)
} else } else
{ {
wxRemoveFile(dest); wxRemoveFile(dest);
buf.Printf(wxT("Unable to unzip %s"), dest.c_str() ); ERR_DIALOG(wxT("Unable to unzip ") + dest, wxT("Freedoom Install"));
ERR_DIALOG(buf, wxT("Freedoom Install"));
} }