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:
parent
71eedc7a5b
commit
1bc4ce9a0a
8 changed files with 224 additions and 255 deletions
|
@ -55,14 +55,14 @@ bool ipodpatcher(int mode,wxString bootloadername)
|
|||
// downloading files
|
||||
if(mode == BOOTLOADER_ADD)
|
||||
{
|
||||
src.Printf(wxT("%s/ipod/%s.ipod"),gv->bootloader_url.c_str(),bootloadername.c_str());
|
||||
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
|
||||
gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str());
|
||||
src = gv->bootloader_url + wxT("/ipod/")
|
||||
+ bootloadername + wxT(".ipod");
|
||||
dest = gv->stdpaths->GetUserDataDir()
|
||||
+ wxT("" PATH_SEP "download" PATH_SEP) + bootloadername;
|
||||
if ( DownloadURL(src, dest) )
|
||||
{
|
||||
wxRemoveFile(dest);
|
||||
buf.Printf(wxT("Unable to download %s"), src.c_str() );
|
||||
ERR_DIALOG(buf, wxT("Install"));
|
||||
ERR_DIALOG(wxT("Unable to download ") + src, wxT("Install"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -191,14 +191,14 @@ bool sansapatcher(int mode,wxString bootloadername)
|
|||
// downloading files
|
||||
if(mode == BOOTLOADER_ADD)
|
||||
{
|
||||
src.Printf(wxT("%s/sandisk-sansa/e200/%s"),gv->bootloader_url.c_str(),bootloadername.c_str());
|
||||
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
|
||||
gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str());
|
||||
src = gv->bootloader_url + wxT("/sandisk-sansa/e200/")
|
||||
+ bootloadername;
|
||||
dest = gv->stdpaths->GetUserDataDir()
|
||||
+ wxT("" PATH_SEP "download" PATH_SEP) + bootloadername;
|
||||
if ( DownloadURL(src, dest) )
|
||||
{
|
||||
wxRemoveFile(dest);
|
||||
buf.Printf(wxT("Unable to download %s"), src.c_str() );
|
||||
ERR_DIALOG(buf, wxT("Download"));
|
||||
ERR_DIALOG(wxT("Unable to download ") + src, wxT("Download"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -270,27 +270,26 @@ bool gigabeatf(int mode,wxString bootloadername,wxString deviceDir)
|
|||
wxString err;
|
||||
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)
|
||||
{
|
||||
//Files downloaden
|
||||
src.Printf(wxT("%s/gigabeat/%s"), gv->bootloader_url.c_str(),bootloadername.c_str());
|
||||
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
|
||||
gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str());
|
||||
src = gv->bootloader_url + wxT("/gigabeat/") + bootloadername;
|
||||
dest = gv->stdpaths->GetUserDataDir()
|
||||
+ wxT("" PATH_SEP "download" PATH_SEP) + bootloadername;
|
||||
if( DownloadURL(src, dest) )
|
||||
{
|
||||
wxRemoveFile(dest);
|
||||
err.Printf(wxT("Unable to download %s"), src.c_str() );
|
||||
ERR_DIALOG(err, wxT("Install"));
|
||||
ERR_DIALOG(wxT("Unable to download ") + src, wxT("Install"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if(!wxFileExists(path1))
|
||||
{
|
||||
err.Printf(wxT("[ERR] Coud not find %s"),path1.c_str());
|
||||
ERR_DIALOG(err, wxT("Bootloader add"));
|
||||
ERR_DIALOG(wxT("[ERR] Coud not find ")+path1, wxT("Bootloader add"));
|
||||
return false;
|
||||
}
|
||||
path2 = path1;
|
||||
|
@ -299,8 +298,8 @@ bool gigabeatf(int mode,wxString bootloadername,wxString deviceDir)
|
|||
{
|
||||
if(!wxRenameFile(path1,path2,false))
|
||||
{
|
||||
err.Printf(wxT("[ERR] Coud not rename %s to %s"),path1.c_str(),path2.c_str());
|
||||
ERR_DIALOG(err, wxT("Bootloader add"));
|
||||
ERR_DIALOG(wxT("[ERR] Coud not rename ") + path1 + wxT(" to ")
|
||||
+ path2, wxT("Bootloader add"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -308,8 +307,8 @@ bool gigabeatf(int mode,wxString bootloadername,wxString deviceDir)
|
|||
|
||||
if(!wxCopyFile(dest,path1))
|
||||
{
|
||||
err.Printf(wxT("[ERR] Coud not copy %s to %s"),dest.c_str(),path2.c_str());
|
||||
ERR_DIALOG(err, wxT("Bootloader add"));
|
||||
ERR_DIALOG(wxT("[ERR] Coud not copy ") + dest + wxT(" to ")
|
||||
+ path2, wxT("Bootloader add"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -319,14 +318,14 @@ bool gigabeatf(int mode,wxString bootloadername,wxString deviceDir)
|
|||
path2.Append(wxT(".ORIG"));
|
||||
if(!wxFileExists(path2))
|
||||
{
|
||||
err.Printf(wxT("[ERR] Coud not find %s"),path1.c_str());
|
||||
ERR_DIALOG(err, wxT("Bootloader del"));
|
||||
ERR_DIALOG(wxT("[ERR] Coud not find ") + path1,
|
||||
wxT("Bootloader del"));
|
||||
return false;
|
||||
}
|
||||
if(!wxRenameFile(path2,path1,true))
|
||||
{
|
||||
err.Printf(wxT("[ERR] Coud not rename %s to %s"),path1.c_str(),path2.c_str());
|
||||
ERR_DIALOG(err, wxT("Bootloader del"));
|
||||
ERR_DIALOG(wxT("[ERR] Coud not rename ") + path1 + wxT(" to ")
|
||||
+ path2, wxT("Bootloader del"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -340,27 +339,27 @@ bool iaudiox5(int mode,wxString bootloadername,wxString deviceDir)
|
|||
wxString err;
|
||||
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)
|
||||
{
|
||||
//Files downloaden
|
||||
src.Printf(wxT("%s/iaudio/%s"),gv->bootloader_url.c_str(),bootloadername.c_str());
|
||||
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
|
||||
gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str());
|
||||
src = gv->bootloader_url + wxT("/iaudio/") + bootloadername;
|
||||
dest = gv->stdpaths->GetUserDataDir()
|
||||
+ wxT("" PATH_SEP "download" PATH_SEP) + bootloadername;
|
||||
if( DownloadURL(src, dest) )
|
||||
{
|
||||
wxRemoveFile(dest);
|
||||
err.Printf(wxT("Unable to download %s"), src.c_str() );
|
||||
ERR_DIALOG(err, wxT("Install"));
|
||||
ERR_DIALOG(wxT("Unable to download ") + src, wxT("Install"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// copy file
|
||||
if(!wxCopyFile(dest,path1))
|
||||
{
|
||||
err.Printf(wxT("[ERR] Coud not copy %s to %s"),dest.c_str(),path2.c_str());
|
||||
ERR_DIALOG(err, wxT("Bootloader add"));
|
||||
ERR_DIALOG(wxT("[ERR] Coud not copy ")+dest+wxT(" to ")+path2,
|
||||
wxT("Bootloader add"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -383,27 +382,26 @@ bool h10(int mode,wxString bootloadername,wxString deviceDir)
|
|||
if(mode == BOOTLOADER_ADD)
|
||||
{
|
||||
//Files downloaden
|
||||
src.Printf(wxT("%s/iriver/%s"), gv->bootloader_url.c_str(),bootloadername.c_str());
|
||||
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
|
||||
gv->stdpaths->GetUserDataDir().c_str(),firmwarename.c_str());
|
||||
src = gv->bootloader_url + wxT("/iriver/") + bootloadername;
|
||||
dest = gv->stdpaths->GetUserDataDir()
|
||||
+ wxT("" PATH_SEP "download" PATH_SEP) + firmwarename;
|
||||
if( DownloadURL(src, dest) )
|
||||
{
|
||||
wxRemoveFile(dest);
|
||||
err.Printf(wxT("Unable to download %s"), src.c_str() );
|
||||
ERR_DIALOG(err, wxT("Install"));
|
||||
ERR_DIALOG(wxT("Unable to download ") + src, wxT("Install"));
|
||||
return false;
|
||||
}
|
||||
|
||||
path1.Printf(wxT("%sSYSTEM" PATH_SEP "%s"),deviceDir.c_str(),firmwarename.c_str());
|
||||
path2.Printf(wxT("%sSYSTEM" PATH_SEP "Original.mi4"),deviceDir.c_str());
|
||||
path1 = deviceDir + wxT("SYSTEM" PATH_SEP) + firmwarename;
|
||||
path2 = deviceDir + wxT("SYSTEM" PATH_SEP "Original.mi4");
|
||||
|
||||
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
|
||||
{
|
||||
err.Printf(wxT("[ERR] File %s does not Exist"),path1.c_str());
|
||||
ERR_DIALOG(err, wxT("Bootloader add"));
|
||||
ERR_DIALOG(wxT("[ERR] File ") + path1 + wxT(" does not Exist"),
|
||||
wxT("Bootloader add"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -411,16 +409,16 @@ bool h10(int mode,wxString bootloadername,wxString deviceDir)
|
|||
{
|
||||
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(err, wxT("Bootloader add"));
|
||||
ERR_DIALOG(wxT("[ERR] Coud not rename ") + path1 + wxT(" to ")
|
||||
+ path2, wxT("Bootloader add"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!wxCopyFile(dest,path1)) // copy file
|
||||
{
|
||||
err.Printf(wxT("[ERR] Coud not copy %s to %s"),dest.c_str(),path1.c_str());
|
||||
ERR_DIALOG(err,wxT("Bootloader add"));
|
||||
ERR_DIALOG(wxT("[ERR] Coud not copy ") + dest + wxT(" to ") + path1,
|
||||
wxT("Bootloader add"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -429,30 +427,30 @@ bool h10(int mode,wxString bootloadername,wxString deviceDir)
|
|||
}
|
||||
else if(mode == BOOTLOADER_REM)
|
||||
{
|
||||
path1.Printf(wxT("%sSYSTEM" PATH_SEP "%s"),deviceDir.c_str(),firmwarename.c_str());
|
||||
path2.Printf(wxT("%sSYSTEM" PATH_SEP "Original.mi4"),gv->curdestdir.c_str());
|
||||
path1 = deviceDir + wxT("SYSTEM" PATH_SEP) + firmwarename;
|
||||
path2 = gv->curdestdir + wxT("SYSTEM" PATH_SEP "Original.mi4");
|
||||
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
|
||||
{
|
||||
err.Printf(wxT("[ERR] File %s does not Exist"),path1.c_str());
|
||||
ERR_DIALOG(err, wxT("Bootloader rem"));
|
||||
ERR_DIALOG(wxT("[ERR] File ") + path1 + wxT(" does not Exist"),
|
||||
wxT("Bootloader rem"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(!wxFileExists(path2)) //Original Firmware dosent exists on player
|
||||
{
|
||||
err.Printf(wxT("[ERR] File %s does not Exist"),path2.c_str());
|
||||
ERR_DIALOG(err, wxT("Bootloader rem"));
|
||||
ERR_DIALOG(wxT("[ERR] File ") + path2 + wxT(" does not Exist"),
|
||||
wxT("Bootloader rem"));
|
||||
return false;
|
||||
}
|
||||
|
||||
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(err, wxT("Bootloader add"));
|
||||
ERR_DIALOG(wxT("[ERR] Coud not rename ") + path2 + wxT(" to ")
|
||||
+ path1, wxT("Bootloader add"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -503,38 +501,42 @@ bool fwpatcher(int mode,wxString bootloadername,wxString deviceDir,wxString firm
|
|||
else
|
||||
{
|
||||
//Download bootloader
|
||||
src.Printf(wxT("%s/iriver/%s"), gv->bootloader_url.c_str(),bootloadername.c_str());
|
||||
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
|
||||
gv->stdpaths->GetUserDataDir().c_str(),bootloadername.c_str());
|
||||
src = gv->bootloader_url + wxT("/iriver/")
|
||||
+ bootloadername;
|
||||
dest = gv->stdpaths->GetUserDataDir()
|
||||
+ wxT("" PATH_SEP "download" PATH_SEP)
|
||||
+ bootloadername;
|
||||
if( DownloadURL(src, dest) )
|
||||
{
|
||||
wxRemoveFile(dest);
|
||||
err.Printf(wxT("Unable to download %s"), src.c_str() );
|
||||
ERR_DIALOG(err, wxT("Install"));
|
||||
ERR_DIALOG(wxT("Unable to download ") + src,
|
||||
wxT("Install"));
|
||||
return false;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
// Load patched Firmware to player
|
||||
src.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "new.hex"),
|
||||
gv->stdpaths->GetUserDataDir().c_str());
|
||||
src = gv->stdpaths->GetUserDataDir()
|
||||
+ wxT("" PATH_SEP "download" PATH_SEP "new.hex");
|
||||
|
||||
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"))
|
||||
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"))
|
||||
dest.Printf(wxT("%s" PATH_SEP "H300.hex"),deviceDir.c_str());
|
||||
dest = deviceDir + wxT("" PATH_SEP "H300.hex");
|
||||
|
||||
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;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -528,9 +528,7 @@ void rockboxInstallDlg::CreateControls()
|
|||
wxBoxSizer3->Add(WxStaticText1,0,wxGROW | wxALL,5);
|
||||
|
||||
wxArrayString array;
|
||||
wxString buf;
|
||||
buf.Printf(wxT("Rockbox stable version (%s)") , gv->last_release.c_str());
|
||||
array.Add(buf);
|
||||
array.Add(wxT("Rockbox stable version (") + gv->last_release + wxT(")"));
|
||||
array.Add(wxT("Archived Build"));
|
||||
array.Add(wxT("Current Build "));
|
||||
|
||||
|
|
|
@ -33,8 +33,7 @@ InstallLog::InstallLog(wxString logname, bool CreateLog)
|
|||
|
||||
if (!logfile)
|
||||
{
|
||||
buf.Printf(_("Failed to create install log file: %s"), logname.c_str());
|
||||
wxLogWarning(buf);
|
||||
wxLogWarning(_("Failed to create install log file: ") + logname);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -42,8 +41,7 @@ InstallLog::InstallLog(wxString logname, bool CreateLog)
|
|||
if (logfile->Exists(wxT("Version")) &&
|
||||
logfile->Read(wxT("Version"), 0l) != LOGFILE_VERSION )
|
||||
{
|
||||
buf.Printf(_("Logfile version mismatch: %s"), logname.c_str() );
|
||||
wxLogWarning(buf);
|
||||
wxLogWarning(_("Logfile version mismatch: ") + logname);
|
||||
delete logfile;
|
||||
return;
|
||||
}
|
||||
|
@ -122,14 +120,14 @@ void InstallLog::EnumerateCurDir(wxString curdir)
|
|||
wxString curname, buf, buf2, pathcache;
|
||||
long dummy;
|
||||
|
||||
buf.Printf(wxT("/FilePaths/%s"), curdir.c_str());
|
||||
buf = wxT("/FilePaths/") + curdir;
|
||||
pathcache = logfile->GetPath();
|
||||
logfile->SetPath(buf);
|
||||
|
||||
contflag = logfile->GetFirstGroup(curname, dummy);
|
||||
while (contflag)
|
||||
{
|
||||
buf.Printf(wxT("%s/%s"), curdir.c_str(), curname.c_str() );
|
||||
buf = curdir + wxT("/") + curname;
|
||||
buf2 = buf; buf2.Replace(wxT("/"), PATH_SEP);
|
||||
workingAS.Add(buf2);
|
||||
EnumerateCurDir(buf);
|
||||
|
@ -141,9 +139,8 @@ void InstallLog::EnumerateCurDir(wxString curdir)
|
|||
{
|
||||
if (curname != wxT(DIRECTORY_KLUDGE) )
|
||||
{
|
||||
buf.Printf(wxT("%s/%s"), curdir.c_str(), curname.c_str() );
|
||||
buf2 = buf; buf2.Replace(wxT("/"), PATH_SEP);
|
||||
workingAS.Add(buf2);
|
||||
buf = curdir + wxT("" PATH_SEP) + curname;
|
||||
workingAS.Add(buf);
|
||||
}
|
||||
contflag = logfile->GetNextEntry(curname, dummy);
|
||||
}
|
||||
|
|
|
@ -61,8 +61,7 @@ bool mkboot(wxString infile, wxString outfile,wxString bootloader,int origin)
|
|||
wxFile f;
|
||||
if(!f.Open(infile))
|
||||
{
|
||||
err.Printf(wxT("Could not open: %s"),infile.c_str());
|
||||
ERR_DIALOG(err, wxT("mkboot"));
|
||||
ERR_DIALOG(wxT("Could not open: ") + infile, wxT("mkboot"));
|
||||
return false;
|
||||
}
|
||||
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 */
|
||||
if(!f.Open(bootloader))
|
||||
{
|
||||
err.Printf(wxT("Could not open: %s"),bootloader.c_str());
|
||||
ERR_DIALOG(err, wxT("mkboot"));
|
||||
ERR_DIALOG(wxT("Could not open: ") + bootloader, wxT("mkboot"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -105,8 +103,7 @@ bool mkboot(wxString infile, wxString outfile,wxString bootloader,int origin)
|
|||
|
||||
if(!f.Open(outfile,wxFile::write))
|
||||
{
|
||||
err.Printf(wxT("Could not open: %s"),outfile.c_str());
|
||||
ERR_DIALOG(err, wxT("mkboot"));
|
||||
ERR_DIALOG(wxT("Could not open: ") + outfile, wxT("mkboot"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -230,14 +227,13 @@ int iriver_decode(wxString infile_name, wxString outfile_name, unsigned int modi
|
|||
|
||||
if(!infile.Open(infile_name))
|
||||
{
|
||||
err.Printf(wxT("Could not open: %s"),infile_name.c_str());
|
||||
ERR_DIALOG(err, wxT("iriver_decode"));
|
||||
ERR_DIALOG(wxT("Could not open: ") + infile_name, wxT("iriver_decode"));
|
||||
return -1;
|
||||
}
|
||||
if(!outfile.Open(outfile_name,wxFile::write))
|
||||
{
|
||||
err.Printf(wxT("Could not open: %s"),outfile_name.c_str());
|
||||
ERR_DIALOG(err, wxT("iriver_decode"));
|
||||
ERR_DIALOG(wxT("Could not open: ") + outfile_name,
|
||||
wxT("iriver_decode"));
|
||||
return -1;
|
||||
}
|
||||
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))
|
||||
{
|
||||
err.Printf(wxT("Could not open: %s"),infile_name.c_str());
|
||||
ERR_DIALOG(err, wxT("iriver_decode"));
|
||||
ERR_DIALOG(wxT("Could not open: ") + infile_name, wxT("iriver_decode"));
|
||||
return -1;
|
||||
}
|
||||
if(!outfile.Open(outfile_name,wxFile::write))
|
||||
{
|
||||
err.Printf(wxT("Could not open: %s"),outfile_name.c_str());
|
||||
ERR_DIALOG(err, wxT("iriver_decode"));
|
||||
ERR_DIALOG(wxT("Could not open: ") + outfile_name,
|
||||
wxT("iriver_decode"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -562,14 +557,14 @@ bool PatchFirmware(wxString firmware,wxString bootloader,int series, int table_e
|
|||
break;
|
||||
}
|
||||
|
||||
name1.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "firmware.bin"),
|
||||
gv->stdpaths->GetUserDataDir().c_str());
|
||||
name1 = gv->stdpaths->GetUserDataDir()
|
||||
+ wxT("" PATH_SEP "download" PATH_SEP "firmware.bin"),
|
||||
/* descrambled file */
|
||||
name2.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "new.bin"),
|
||||
gv->stdpaths->GetUserDataDir().c_str());
|
||||
name2 = gv->stdpaths->GetUserDataDir()
|
||||
+ wxT("" PATH_SEP "download" PATH_SEP "new.bin");
|
||||
/* patched file */
|
||||
name3.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "new.hex"),
|
||||
gv->stdpaths->GetUserDataDir().c_str());
|
||||
name3 = gv->stdpaths->GetUserDataDir()
|
||||
+ wxT("" PATH_SEP "download" PATH_SEP "new.hex");
|
||||
if (iriver_decode(firmware, name1, FALSE, STRIP_NONE) == -1) {
|
||||
ERR_DIALOG(wxT("Error in descramble"), wxT("Descramble Firmware"));
|
||||
wxRemoveFile(name1);
|
||||
|
|
|
@ -65,28 +65,28 @@ bool InstallTheme(wxString Themesrc)
|
|||
int pos = Themesrc.Find('/',true);
|
||||
wxString themename = Themesrc.SubString(pos+1,Themesrc.Length());
|
||||
|
||||
src.Printf(wxT("%s/%s"), gv->themes_url.c_str(),Themesrc.c_str());
|
||||
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
|
||||
gv->stdpaths->GetUserDataDir().c_str(),themename.c_str());
|
||||
src = gv->themes_url + wxT("/") + Themesrc;
|
||||
dest = gv->stdpaths->GetUserDataDir()
|
||||
+ wxT("" PATH_SEP "download" PATH_SEP) + themename;
|
||||
if( DownloadURL(src, dest) )
|
||||
{
|
||||
wxRemoveFile(dest);
|
||||
err.Printf(wxT("Unable to download %s"), src.c_str() );
|
||||
ERR_DIALOG(err, wxT("Install Theme"));
|
||||
ERR_DIALOG(wxT("Unable to download ") + src, wxT("Install Theme"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!checkZip(dest))
|
||||
{
|
||||
err.Printf(wxT("The Zip %s does not contain the correct dir structure"), dest.c_str());
|
||||
ERR_DIALOG(err, wxT("Install Theme"));
|
||||
ERR_DIALOG(wxT("The Zip ") + dest
|
||||
+ wxT(" does not contain the correct dir structure"),
|
||||
wxT("Install Theme"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(UnzipFile(dest,gv->curdestdir, true))
|
||||
{
|
||||
err.Printf(wxT("Unable to unzip %s to %s"), dest.c_str(), gv->curdestdir.c_str());
|
||||
ERR_DIALOG(err, wxT("Install Theme"));
|
||||
ERR_DIALOG(wxT("Unable to unzip ") + dest + wxT(" to ")
|
||||
+ gv->curdestdir, wxT("Install Theme"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ int DownloadURL(wxString src, wxString dest)
|
|||
wxLogVerbose(wxT("=== begin DownloadURL(%s,%s)"), src.c_str(),
|
||||
dest.c_str());
|
||||
|
||||
buf.Printf(wxT("Fetching %s"), src.c_str());
|
||||
buf = wxT("Fetching ") + src;
|
||||
wxProgressDialog* progress = new wxProgressDialog(wxT("Downloading"),
|
||||
buf, 100, NULL, wxPD_APP_MODAL |
|
||||
wxPD_AUTO_HIDE | wxPD_SMOOTH | wxPD_ELAPSED_TIME |
|
||||
|
@ -174,8 +174,8 @@ int DownloadURL(wxString src, wxString dest)
|
|||
} else
|
||||
{
|
||||
errnum = os->GetLastError();
|
||||
errstr.Printf(wxT("Can't write to output stream (%s)"),
|
||||
stream_err_str(errnum).c_str() );
|
||||
errstr = wxT("Can't write to output stream (")
|
||||
+ stream_err_str(errnum) + wxT(")");
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -188,8 +188,8 @@ int DownloadURL(wxString src, wxString dest)
|
|||
errnum = 0;
|
||||
break;
|
||||
}
|
||||
errstr.Printf(wxT("Can't read from input stream (%s)"),
|
||||
stream_err_str(errnum).c_str() );
|
||||
errstr = wxT("Can't read from input stream (")
|
||||
+ stream_err_str(errnum) + wxT(")");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,8 +197,8 @@ int DownloadURL(wxString src, wxString dest)
|
|||
if (! errnum)
|
||||
{
|
||||
errnum = os->GetLastError();
|
||||
errstr.Printf(wxT("Can't close output file (%s)"),
|
||||
stream_err_str(errnum).c_str() );
|
||||
errstr = wxT("Can't close output file (")
|
||||
+ stream_err_str(errnum) + wxT(")");
|
||||
|
||||
input = false;
|
||||
}
|
||||
|
@ -208,9 +208,8 @@ int DownloadURL(wxString src, wxString dest)
|
|||
} else
|
||||
{
|
||||
errnum = is->GetLastError();
|
||||
errstr.Printf(wxT("Can't get input stream size (%s)"),
|
||||
stream_err_str(errnum).c_str() );
|
||||
|
||||
errstr = wxT("Can't get input stream size (")
|
||||
+ stream_err_str(errnum) + wxT(")");
|
||||
}
|
||||
} else
|
||||
{
|
||||
|
@ -221,8 +220,8 @@ int DownloadURL(wxString src, wxString dest)
|
|||
} else
|
||||
{
|
||||
errnum = os->GetLastError();
|
||||
errstr.Printf(wxT("Can't create output stream (%s)"),
|
||||
stream_err_str(errnum).c_str() );
|
||||
errstr = wxT("Can't create output stream (")
|
||||
+ stream_err_str(errnum) + wxT(")");
|
||||
}
|
||||
delete os;
|
||||
} else
|
||||
|
@ -240,14 +239,11 @@ int DownloadURL(wxString src, wxString dest)
|
|||
if (errnum == 0) errnum = 999;
|
||||
if (input)
|
||||
{
|
||||
buf.Printf(wxT("%s reading\n%s"),
|
||||
errstr.c_str(), src.c_str());
|
||||
ERR_DIALOG(buf, wxT("Download URL"));
|
||||
ERR_DIALOG(errstr + wxT(" reading\n") + src, wxT("Download URL"));
|
||||
} else
|
||||
{
|
||||
buf.Printf(wxT("%s writing to download\n/%s"),
|
||||
errstr.c_str(), dest.c_str());
|
||||
ERR_DIALOG(buf, wxT("Download URL"));
|
||||
ERR_DIALOG(errstr + wxT("writing to download\n/") + dest,
|
||||
wxT("Download URL"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -273,9 +269,9 @@ int UnzipFile(wxString src, wxString destdir, bool isInstall)
|
|||
if (! in_zip->IsOk() )
|
||||
{
|
||||
errnum = in_zip->GetLastError();
|
||||
buf.Printf(wxT("Can't open ZIP stream %s for reading (%s)"),
|
||||
src.c_str(), stream_err_str(errnum).c_str() );
|
||||
ERR_DIALOG(buf, wxT("Unzip File") );
|
||||
ERR_DIALOG(wxT("Can't open ZIP stream ") + src
|
||||
+ wxT(" for reading (") + stream_err_str(errnum)
|
||||
+ wxT(")"), wxT("Unzip File") );
|
||||
delete in_zip;
|
||||
delete in_file;
|
||||
return true;
|
||||
|
@ -285,9 +281,9 @@ int UnzipFile(wxString src, wxString destdir, bool isInstall)
|
|||
if (! in_zip->IsOk() )
|
||||
{
|
||||
errnum = in_zip->GetLastError();
|
||||
buf.Printf(wxT("Error Getting total ZIP entries for %s (%s)"),
|
||||
src.c_str(), stream_err_str(errnum).c_str() );
|
||||
ERR_DIALOG(buf, wxT("Unzip File") );
|
||||
ERR_DIALOG( wxT("Error Getting total ZIP entries for ")
|
||||
+ src + wxT(" (") + stream_err_str(errnum) + wxT(")"),
|
||||
wxT("Unzip File") );
|
||||
delete in_zip;
|
||||
delete in_file;
|
||||
return true;
|
||||
|
@ -295,9 +291,8 @@ int UnzipFile(wxString src, wxString destdir, bool isInstall)
|
|||
} else
|
||||
{
|
||||
errnum = in_file->GetLastError();
|
||||
buf.Printf(wxT("Can't open %s (%s)"), src.c_str(),
|
||||
stream_err_str(errnum).c_str() );
|
||||
ERR_DIALOG(buf, wxT("Unzip File") );
|
||||
ERR_DIALOG(wxT("Can't open ") + src + wxT(" (")
|
||||
+ stream_err_str(errnum) + wxT(")"), wxT("Unzip File") );
|
||||
delete in_zip;
|
||||
delete in_file;
|
||||
return true;
|
||||
|
@ -313,8 +308,7 @@ int UnzipFile(wxString src, wxString destdir, bool isInstall)
|
|||
// We're not overly worried if the logging fails
|
||||
if (isInstall)
|
||||
{
|
||||
buf.Printf(wxT("%s" PATH_SEP UNINSTALL_FILE), destdir.c_str());
|
||||
log = new InstallLog(buf);
|
||||
log = new InstallLog(destdir + wxT("" PATH_SEP UNINSTALL_FILE));
|
||||
}
|
||||
|
||||
while (! errnum &&
|
||||
|
@ -323,21 +317,19 @@ int UnzipFile(wxString src, wxString destdir, bool isInstall)
|
|||
|
||||
curfile++;
|
||||
wxString name = entry->GetName();
|
||||
progress_msg.Printf(wxT("Unpacking %s"), name.c_str());
|
||||
progress_msg = wxT("Unpacking ") + name;
|
||||
if (! progress->Update(curfile, progress_msg) ) {
|
||||
buf.Printf(wxT("Unpacking cancelled by user"));
|
||||
MESG_DIALOG(buf);
|
||||
MESG_DIALOG(wxT("Unpacking cancelled by user"));
|
||||
errnum = 1000;
|
||||
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 (!wxDirExists(in_str) ) {
|
||||
if (! wxMkdir(in_str, 0777) ) {
|
||||
buf.Printf(wxT("Unable to create directory %s"),
|
||||
in_str.c_str() );
|
||||
buf = wxT("Unable to create directory ") + in_str;
|
||||
errnum = 100;
|
||||
break;
|
||||
}
|
||||
|
@ -349,7 +341,7 @@ int UnzipFile(wxString src, wxString destdir, bool isInstall)
|
|||
wxFFileOutputStream* out = new wxFFileOutputStream(in_str);
|
||||
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;
|
||||
return 100;
|
||||
} else if (isInstall)
|
||||
|
@ -410,7 +402,7 @@ int Uninstall(const wxString dir, bool 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
|
||||
FilesToRemove = log->GetInstalledFiles();
|
||||
if (log) delete log;
|
||||
|
@ -439,7 +431,7 @@ int Uninstall(const wxString dir, bool isFullUninstall) {
|
|||
|
||||
if (isFullUninstall )
|
||||
{
|
||||
buf.Printf(wxT("%s" PATH_SEP ".rockbox"), dir.c_str());
|
||||
buf = dir + wxT("" PATH_SEP ".rockbox");
|
||||
if (rm_rf(buf) )
|
||||
{
|
||||
WARN_DIALOG(wxT("Unable to completely remove Rockbox directory"),
|
||||
|
@ -473,8 +465,8 @@ int Uninstall(const wxString dir, bool isFullUninstall) {
|
|||
{
|
||||
if (! wxRemoveFile((*special)[i]) )
|
||||
{
|
||||
buf.Printf(wxT("Can't delete %s"), (*special)[i].c_str());
|
||||
WARN_DIALOG(buf.c_str(), wxT("Full uninstall"));
|
||||
WARN_DIALOG(wxT("Can't delete ") + (*special)[i],
|
||||
wxT("Full uninstall"));
|
||||
errflag = true;
|
||||
}
|
||||
}
|
||||
|
@ -500,7 +492,7 @@ int Uninstall(const wxString dir, bool isFullUninstall) {
|
|||
}
|
||||
|
||||
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());
|
||||
|
||||
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
|
||||
// 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()) )
|
||||
{
|
||||
buf2->Printf(wxT("%s" PATH_SEP UNINSTALL_FILE), dir.c_str());
|
||||
*buf2 = dir +wxT("" PATH_SEP UNINSTALL_FILE);
|
||||
wxRemoveFile(*buf2);
|
||||
}
|
||||
|
||||
|
@ -595,7 +587,7 @@ bool InstallRbutil(wxString dest)
|
|||
bool copied_exe = false, made_rbdir = false;
|
||||
InstallLog* log;
|
||||
|
||||
buf.Printf(wxT("%s" PATH_SEP ".rockbox"), dest.c_str() );
|
||||
buf = dest + wxT("" PATH_SEP ".rockbox");
|
||||
|
||||
if (! wxDirExists(buf) )
|
||||
{
|
||||
|
@ -603,18 +595,17 @@ bool InstallRbutil(wxString dest)
|
|||
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);
|
||||
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 (! wxMkdir(destdir, 0777) )
|
||||
{
|
||||
buf.Printf(wxT("%s (%s)"),
|
||||
wxT("Unable to create directory for installer"), destdir.c_str());
|
||||
WARN_DIALOG(buf , wxT("Portable install") );
|
||||
WARN_DIALOG( wxT("Unable to create directory for installer (")
|
||||
+ destdir + wxT(")"), wxT("Portable install") );
|
||||
return false;
|
||||
}
|
||||
log->WriteFile(wxT("RockboxUtility"), true);
|
||||
|
@ -636,13 +627,13 @@ bool InstallRbutil(wxString dest)
|
|||
copied_exe = true;
|
||||
}
|
||||
|
||||
dstr.Printf(wxT("%s" PATH_SEP "%s"), destdir.c_str(),
|
||||
filestocopy[i].AfterLast(PATH_SEP_CHR).c_str());
|
||||
dstr = destdir + wxT("" PATH_SEP)
|
||||
+ filestocopy[i].AfterLast(PATH_SEP_CHR);
|
||||
if (! wxCopyFile(filestocopy[i], dstr) )
|
||||
{
|
||||
buf.Printf(wxT("%s (%s -> %s)"),
|
||||
wxT("Error copying file"), filestocopy[i].c_str(), dstr.c_str());
|
||||
WARN_DIALOG(buf, wxT("Portable Install") );
|
||||
WARN_DIALOG( wxT("Error copying file (")
|
||||
+ filestocopy[i].c_str() + wxT(" -> ")
|
||||
+ dstr + wxT(")"), wxT("Portable Install") );
|
||||
return false;
|
||||
}
|
||||
buf = dstr;
|
||||
|
@ -652,13 +643,12 @@ bool InstallRbutil(wxString dest)
|
|||
|
||||
if (! copied_exe)
|
||||
{
|
||||
str.Printf(wxT("%s" PATH_SEP EXE_NAME), gv->AppDir.c_str());
|
||||
dstr.Printf(wxT("%s" PATH_SEP EXE_NAME), destdir.c_str());
|
||||
str = gv->AppDir + wxT("" PATH_SEP EXE_NAME);
|
||||
dstr = destdir + wxT("" PATH_SEP EXE_NAME);
|
||||
if (! wxCopyFile(str, dstr) )
|
||||
{
|
||||
buf.Printf(wxT("Can't copy program binary %s -> %s"),
|
||||
str.c_str(), dstr.c_str() );
|
||||
WARN_DIALOG(buf, wxT("Portable Install") );
|
||||
WARN_DIALOG(wxT("Can't copy program binary ")
|
||||
+ str + wxT(" -> ") + dstr, wxT("Portable Install") );
|
||||
return false;
|
||||
}
|
||||
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
|
||||
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) )
|
||||
{
|
||||
buf.Printf(wxT("%s (%s -> %s)"),
|
||||
wxT("Unable to install user config file"), gv->UserConfigFile.c_str(),
|
||||
dstr.c_str() );
|
||||
WARN_DIALOG(buf, wxT("Portable Install") );
|
||||
WARN_DIALOG(wxT("Unable to install user config file (")
|
||||
+ gv->UserConfigFile + wxT(" -> ") + dstr + wxT(")"),
|
||||
wxT("Portable Install") );
|
||||
return false;
|
||||
}
|
||||
buf = dstr;
|
||||
|
@ -718,7 +707,7 @@ bool rm_rf(wxString file)
|
|||
wxLogVerbose(selected[i]);
|
||||
if (progress != NULL)
|
||||
{
|
||||
buf.Printf(wxT("Deleting %s"), selected[i].c_str() );
|
||||
buf = wxT("Deleting ") + selected[i];
|
||||
if (! progress->Update(i, buf))
|
||||
{
|
||||
WARN_DIALOG(wxT("Cancelled by user"), wxT("Erase Files"));
|
||||
|
@ -731,23 +720,22 @@ bool rm_rf(wxString file)
|
|||
{
|
||||
if ((rc = ! wxRmdir(selected[i])) )
|
||||
{
|
||||
buf.Printf(wxT("Can't remove directory %s"),
|
||||
selected[i].c_str());
|
||||
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])) )
|
||||
{
|
||||
buf.Printf(wxT("Error deleting file %s"), selected[i].c_str() );
|
||||
errflag = true;
|
||||
WARN_DIALOG(buf.c_str(),wxT("Erase files"));
|
||||
WARN_DIALOG(wxT("Error deleting file ") + selected[i],
|
||||
wxT("Erase files"));
|
||||
}
|
||||
}
|
||||
delete progress;
|
||||
} else
|
||||
{
|
||||
buf.Printf(wxT("Can't find expected file %s"), file.c_str());
|
||||
WARN_DIALOG(buf.c_str(), wxT("Erase files"));
|
||||
WARN_DIALOG(wxT("Can't find expected file ") + file,
|
||||
wxT("Erase files"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -127,13 +127,15 @@ bool rbutilFrmApp::ReadGlobalConfig(rbutilFrm* myFrame)
|
|||
// then in the user config dir (linux ~/) and
|
||||
// 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) )
|
||||
{
|
||||
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) )
|
||||
{
|
||||
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;
|
||||
|
||||
buf.Printf(wxT("%s" PATH_SEP "RockboxUtility.cfg"),
|
||||
gv->AppDir.c_str());
|
||||
buf = gv->AppDir + wxT("" PATH_SEP "RockboxUtility.cfg");
|
||||
|
||||
if (wxFileExists(buf) )
|
||||
{
|
||||
|
@ -242,8 +243,8 @@ void rbutilFrmApp::ReadUserConfig()
|
|||
else
|
||||
{
|
||||
gv->portable = false;
|
||||
buf.Printf(wxT("%s" PATH_SEP "%s"),
|
||||
gv->stdpaths->GetUserDataDir().c_str(), wxT("RockboxUtility.cfg"));
|
||||
buf = gv->stdpaths->GetUserDataDir()
|
||||
+ wxT("" PATH_SEP "RockboxUtility.cfg");
|
||||
}
|
||||
|
||||
gv->UserConfig = new wxFileConfig(wxEmptyString, wxEmptyString, buf);
|
||||
|
|
|
@ -167,9 +167,9 @@ void ThemeCtrl::setDevice(wxString device)
|
|||
//get correct Themes list
|
||||
wxString src,dest,err;
|
||||
|
||||
src.Printf(wxT("%srbutil.php?res=%s"),gv->themes_url.c_str(),m_currentResolution.c_str());
|
||||
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s.list"),
|
||||
gv->stdpaths->GetUserDataDir().c_str(),m_currentResolution.c_str());
|
||||
src = gv->themes_url + wxT("rbutil.php?res=") + m_currentResolution;
|
||||
dest = gv->stdpaths->GetUserDataDir() + wxT("" PATH_SEP "download" PATH_SEP)
|
||||
+ m_currentResolution + wxT(".list");
|
||||
|
||||
if(DownloadURL(src, dest))
|
||||
{
|
||||
|
@ -249,16 +249,18 @@ void ThemeCtrl::ThemePreview()
|
|||
int pos = m_Themes_image[index].Find('/',true);
|
||||
wxString filename = m_Themes_image[index](pos+1,m_Themes_image[index].Length());
|
||||
|
||||
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s"),
|
||||
gv->stdpaths->GetUserDataDir().c_str(),m_currentResolution.c_str());
|
||||
dest = gv->stdpaths->GetUserDataDir()
|
||||
+ wxT("" PATH_SEP "download" PATH_SEP)
|
||||
+ m_currentResolution;
|
||||
|
||||
if(!wxDirExists(dest))
|
||||
wxMkdir(dest);
|
||||
|
||||
//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());
|
||||
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s" PATH_SEP "%s"),
|
||||
gv->stdpaths->GetUserDataDir().c_str(),m_currentResolution.c_str(),filename.c_str());
|
||||
src = gv->themes_url + wxT("/data/") + m_currentResolution + wxT("/")
|
||||
+ filename;
|
||||
dest = gv->stdpaths->GetUserDataDir() + wxT("" PATH_SEP "download" PATH_SEP)
|
||||
+ m_currentResolution + wxT("" PATH_SEP) + filename;
|
||||
|
||||
if(DownloadURL(src, dest))
|
||||
{
|
||||
|
|
|
@ -336,12 +336,12 @@ void rbutilFrm::OnManualUpdate(wxUpdateUIEvent& event)
|
|||
|
||||
// construct link to pdf
|
||||
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);
|
||||
|
||||
// construct link to html
|
||||
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))
|
||||
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;
|
||||
}
|
||||
|
||||
cacheloc.Printf(wxT("%s" PATH_SEP "download"),
|
||||
datadir.c_str());
|
||||
cacheloc = datadir + wxT("" PATH_SEP "download");
|
||||
|
||||
if (! rm_rf(cacheloc) )
|
||||
{
|
||||
|
@ -659,17 +658,15 @@ void rbutilFrm::OnInstallBtn(wxCommandEvent& event)
|
|||
{
|
||||
case BUILD_RELEASE:
|
||||
// This is a URL - don't use PATH_SEP
|
||||
src.Printf(wxT("%s%s-%s-%s.zip"),
|
||||
gv->download_url.c_str(), gv->prog_name.c_str(),
|
||||
gv->last_release.c_str(), gv->curplat.c_str());
|
||||
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s-%s-%s.zip"),
|
||||
gv->stdpaths->GetUserDataDir().c_str(),
|
||||
gv->prog_name.c_str(), gv->last_release.c_str(),
|
||||
gv->curplat.c_str());
|
||||
src = gv->download_url + gv->prog_name + wxT("-")
|
||||
+ gv->last_release + wxT("-") + gv->curplat + wxT(".zip");
|
||||
dest = gv->stdpaths->GetUserDataDir() + wxT("download" PATH_SEP)
|
||||
+ gv->prog_name + wxT("-") + gv->last_release + wxT("-")
|
||||
+ gv->curplat + wxT(".zip");
|
||||
break;
|
||||
case BUILD_DAILY:
|
||||
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "build-info"),
|
||||
gv->stdpaths->GetUserDataDir().c_str());
|
||||
dest = gv->stdpaths->GetUserDataDir()
|
||||
+ PATH_SEP + wxT("download") + PATH_SEP + wxT("build-info");
|
||||
if (DownloadURL(gv->server_conf_url, dest)) {
|
||||
WARN_DIALOG(wxT("Unable to download build status."),
|
||||
wxT("Install"));
|
||||
|
@ -682,7 +679,7 @@ void rbutilFrm::OnInstallBtn(wxCommandEvent& event)
|
|||
buildinfo->DeleteAll();
|
||||
|
||||
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"));
|
||||
buf = wxT("");
|
||||
}
|
||||
|
@ -696,23 +693,19 @@ void rbutilFrm::OnInstallBtn(wxCommandEvent& event)
|
|||
buf = date.Format(wxT("%Y%m%d")); // yes, we want UTC
|
||||
}
|
||||
|
||||
src.Printf(wxT("%s%s/%s-%s-%s.zip"),
|
||||
gv->daily_url.c_str(), gv->curplat.c_str(),
|
||||
gv->prog_name.c_str(), gv->curplat.c_str(),
|
||||
buf.c_str() );
|
||||
src = gv->daily_url + gv->curplat + wxT("/") + gv->prog_name
|
||||
+ wxT("-") + gv->curplat + wxT("-") + buf + wxT(".zip");
|
||||
|
||||
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s-%s-%s.zip"),
|
||||
gv->stdpaths->GetUserDataDir().c_str(),
|
||||
gv->prog_name.c_str(),
|
||||
gv->curplat.c_str(), buf.c_str() );
|
||||
dest = gv->stdpaths->GetUserDataDir() + PATH_SEP wxT("download")
|
||||
+ gv->prog_name + wxT("-") + gv->curplat + wxT("-")
|
||||
+ buf + wxT(".zip");
|
||||
break;
|
||||
case BUILD_BLEEDING:
|
||||
src.Printf(wxT("%s%s/%s.zip"),
|
||||
gv->bleeding_url.c_str(), gv->curplat.c_str(),
|
||||
gv->prog_name.c_str() );
|
||||
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "%s.zip"),
|
||||
gv->stdpaths->GetUserDataDir().c_str(),
|
||||
gv->prog_name.c_str() );
|
||||
src = gv->bleeding_url + gv->curplat + wxT("/")
|
||||
+ gv->prog_name + wxT(".zip");
|
||||
dest = gv->stdpaths->GetUserDataDir()
|
||||
+ PATH_SEP wxT("download") PATH_SEP
|
||||
+ gv->prog_name + wxT(".zip");
|
||||
break;
|
||||
default:
|
||||
ERR_DIALOG(wxT("Something seriously odd has happened."),
|
||||
|
@ -726,8 +719,7 @@ void rbutilFrm::OnInstallBtn(wxCommandEvent& event)
|
|||
if ( DownloadURL(src, dest) )
|
||||
{
|
||||
wxRemoveFile(dest);
|
||||
buf.Printf(wxT("Unable to download %s"), src.c_str() );
|
||||
ERR_DIALOG(buf, wxT("Install"));
|
||||
ERR_DIALOG(wxT("Unable to download ")+src, wxT("Install"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -741,8 +733,7 @@ void rbutilFrm::OnInstallBtn(wxCommandEvent& event)
|
|||
} else
|
||||
{
|
||||
wxRemoveFile(dest);
|
||||
buf.Printf(wxT("Unable to unzip %s"), dest.c_str() );
|
||||
ERR_DIALOG(buf, wxT("Install"));
|
||||
ERR_DIALOG(wxT("Unable to unzip ")+dest, wxT("Install"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -775,17 +766,17 @@ void rbutilFrm::OnFontBtn(wxCommandEvent& event)
|
|||
return;
|
||||
|
||||
|
||||
buf.Printf(wxT("%s" PATH_SEP ".rockbox"), gv->curdestdir.c_str()) ;
|
||||
buf = gv->curdestdir + wxT("" PATH_SEP ".rockbox");
|
||||
if (! wxDirExists(buf) )
|
||||
{
|
||||
buf.Printf(wxT("Rockbox is not yet installed on %s - install "
|
||||
"Rockbox first."), buf.c_str() );
|
||||
WARN_DIALOG(buf, wxT("Can't install fonts") );
|
||||
WARN_DIALOG(wxT("Rockbox is not yet installed on ") + buf
|
||||
+ wxT(" - install Rockbox first."),
|
||||
wxT("Can't install fonts") );
|
||||
return;
|
||||
}
|
||||
|
||||
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "build-info"),
|
||||
gv->stdpaths->GetUserDataDir().c_str());
|
||||
dest = gv->stdpaths->GetUserDataDir()
|
||||
+ wxT( "" PATH_SEP "download" PATH_SEP "build-info");
|
||||
if (DownloadURL(gv->server_conf_url, dest))
|
||||
{
|
||||
WARN_DIALOG(wxT("Unable to download build status."),
|
||||
|
@ -799,8 +790,7 @@ void rbutilFrm::OnFontBtn(wxCommandEvent& event)
|
|||
buildinfo->DeleteAll();
|
||||
|
||||
if (buf.Len() != 8) {
|
||||
dest.Printf(wxT("Invalid build date: %s"), buf.c_str());
|
||||
WARN_DIALOG(dest, wxT("Font Install"));
|
||||
WARN_DIALOG(wxT("Invalid build date: ") + buf, wxT("Font Install"));
|
||||
buf = wxT("");
|
||||
}
|
||||
}
|
||||
|
@ -814,19 +804,17 @@ void rbutilFrm::OnFontBtn(wxCommandEvent& event)
|
|||
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
|
||||
"rockbox-fonts-%s.zip"), gv->stdpaths->GetUserDataDir().c_str(),
|
||||
buf.c_str() );
|
||||
dest = gv->stdpaths->GetUserDataDir() + wxT( "" PATH_SEP "download"
|
||||
PATH_SEP "rockbox-fonts-") + buf + wxT(".zip");
|
||||
|
||||
if ( ! wxFileExists(dest) )
|
||||
{
|
||||
if ( DownloadURL(src, dest) )
|
||||
{
|
||||
wxRemoveFile(dest);
|
||||
buf.Printf(wxT("Unable to download %s"), src.c_str() );
|
||||
ERR_DIALOG(buf, wxT("Font Install"));
|
||||
ERR_DIALOG(wxT("Unable to download ") + src, wxT("Font Install"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -840,8 +828,7 @@ void rbutilFrm::OnFontBtn(wxCommandEvent& event)
|
|||
} else
|
||||
{
|
||||
wxRemoveFile(dest);
|
||||
buf.Printf(wxT("Unable to unzip %s"), dest.c_str() );
|
||||
ERR_DIALOG(buf, wxT("Font Install"));
|
||||
ERR_DIALOG(wxT("Unable to unzip ") + dest, wxT("Font Install"));
|
||||
}
|
||||
|
||||
wxLogVerbose(wxT("=== end rbutilFrm::OnFontBtn"));
|
||||
|
@ -867,27 +854,27 @@ void rbutilFrm::OnDoomBtn(wxCommandEvent& event)
|
|||
if(msg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
buf.Printf(wxT("%s" PATH_SEP ".rockbox"), gv->curdestdir.c_str()) ;
|
||||
buf = gv->curdestdir + wxT("" PATH_SEP ".rockbox");
|
||||
if (! wxDirExists(buf) )
|
||||
{
|
||||
buf.Printf(wxT("Rockbox is not yet installed on %s - install "
|
||||
"Rockbox first."), buf.c_str() );
|
||||
WARN_DIALOG(buf, wxT("Can't install freedoom wads") );
|
||||
WARN_DIALOG(wxT("Rockbox is not yet installed on ") + buf
|
||||
+ wxT(" - install Rockbox first."),
|
||||
wxT("Can't install freedoom wads") );
|
||||
return;
|
||||
}
|
||||
|
||||
src = gv->doom_url;
|
||||
|
||||
dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP
|
||||
"rockdoom.zip"), gv->stdpaths->GetUserDataDir().c_str());
|
||||
dest = gv->stdpaths->GetUserDataDir() + wxT("" PATH_SEP "download" PATH_SEP
|
||||
"rockdoom.zip");
|
||||
|
||||
if ( ! wxFileExists(dest) )
|
||||
{
|
||||
if ( DownloadURL(src, dest) )
|
||||
{
|
||||
wxRemoveFile(dest);
|
||||
buf.Printf(wxT("Unable to download %s"), src.c_str() );
|
||||
ERR_DIALOG(buf, wxT("Freedoom Install"));
|
||||
ERR_DIALOG(wxT("Unable to download ") + src,
|
||||
wxT("Freedoom Install"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -901,8 +888,7 @@ void rbutilFrm::OnDoomBtn(wxCommandEvent& event)
|
|||
} else
|
||||
{
|
||||
wxRemoveFile(dest);
|
||||
buf.Printf(wxT("Unable to unzip %s"), dest.c_str() );
|
||||
ERR_DIALOG(buf, wxT("Freedoom Install"));
|
||||
ERR_DIALOG(wxT("Unable to unzip ") + dest, wxT("Freedoom Install"));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue