summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristi Scarborough <christi@coraline.org>2006-12-14 03:55:15 +0000
committerChristi Scarborough <christi@coraline.org>2006-12-14 03:55:15 +0000
commit5003669541a59137750498d2b5503b9c93cc12d6 (patch)
tree56f81eebf30e20605e2dc66cac4cdc514d993d71
parent8f08f29a6607c529c627855a0753f76da73e13c0 (diff)
downloadrockbox-5003669541a59137750498d2b5503b9c93cc12d6.tar.gz
rockbox-5003669541a59137750498d2b5503b9c93cc12d6.zip
Newer shinier install log file which is more intelligent and better able to cope with multiple packages being installed. This breaks compatibility with the old uninstall file format.
Various bug fixes and tidy ups. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11757 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--rbutil/Makefile4
-rw-r--r--rbutil/credits.h4
-rw-r--r--rbutil/installlog.cpp153
-rw-r--r--rbutil/installlog.h61
-rw-r--r--rbutil/rbutil-rc.rc10
-rw-r--r--rbutil/rbutil.cpp127
-rw-r--r--rbutil/rbutil.iss6
-rw-r--r--rbutil/rbutilApp.cpp1
-rw-r--r--rbutil/rbutilApp.h26
-rw-r--r--rbutil/rbutilFrm.cpp15
-rw-r--r--rbutil/wizard_pages.cpp20
-rw-r--r--rbutil/wizard_pages.h21
-rw-r--r--rbutil/wx_pch.h20
13 files changed, 385 insertions, 83 deletions
diff --git a/rbutil/Makefile b/rbutil/Makefile
index a665e182fd..f436b7a8be 100644
--- a/rbutil/Makefile
+++ b/rbutil/Makefile
@@ -7,11 +7,11 @@
7# $Id$ 7# $Id$
8# 8#
9 9
10# Unix-style Makefile for rbutil 10# Unix-style Makefile for rbutil
11 11
12 12
13CXX=$(shell $(PREFIX)wx-config --cxx) 13CXX=$(shell $(PREFIX)wx-config --cxx)
14OBJS=rbutil.o rbutilApp.o rbutilFrm.o wizard_pages.o 14OBJS=rbutil.o rbutilApp.o rbutilFrm.o wizard_pages.o installog.o
15 15
16 16
17# type "make WIN=1" for a Windows build using the Debian mingw cross-compiler 17# type "make WIN=1" for a Windows build using the Debian mingw cross-compiler
diff --git a/rbutil/credits.h b/rbutil/credits.h
index fe9bdb18f5..52ce7c599c 100644
--- a/rbutil/credits.h
+++ b/rbutil/credits.h
@@ -26,7 +26,7 @@
26 26
27static char* rbutil_developers[] = { 27static char* rbutil_developers[] = {
28 "Christi Alice Scarborough", 28 "Christi Alice Scarborough",
29 "" 29 "Dave Chapman"
30}; 30};
31 31
32//static char* rbutil_translators[] = ( 32//static char* rbutil_translators[] = (
@@ -37,7 +37,7 @@ static char* rbutil_developers[] = {
37#define RBUTIL_COPYRIGHT "(C) 2005-6 The Rockbox Team - " \ 37#define RBUTIL_COPYRIGHT "(C) 2005-6 The Rockbox Team - " \
38 "released under the GNU Public License v2" 38 "released under the GNU Public License v2"
39#define RBUTIL_DESCRIPTION "Utility for performing housekeepng tasks for" \ 39#define RBUTIL_DESCRIPTION "Utility for performing housekeepng tasks for" \
40 "the Rockbox audio jukebox firmware." 40 "the Rockbox open\nsource digital audio player firmware."
41 41
42 42
43class AboutDlg: public wxDialog 43class AboutDlg: public wxDialog
diff --git a/rbutil/installlog.cpp b/rbutil/installlog.cpp
new file mode 100644
index 0000000000..e9dad794cb
--- /dev/null
+++ b/rbutil/installlog.cpp
@@ -0,0 +1,153 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * Module: rbutil
9 * File: installlog.cpp
10 *
11 * Copyright (C) 2006 Christi Alice Scarborough
12 *
13 * All files in this archive are subject to the GNU General Public License.
14 * See the file COPYING in the source tree root for full license agreement.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20
21#include "installlog.h"
22#include "rbutil.h"
23
24InstallLog::InstallLog(wxString logname, bool CreateLog)
25{
26 wxString buf;
27 dirtyflag = true;
28
29 if (! CreateLog && ! wxFileExists(logname) ) return;
30
31 logfile = new wxFileConfig(wxEmptyString, wxEmptyString, logname);
32
33
34 if (!logfile)
35 {
36 buf.Printf(_("Failed to create install log file: %s"), logname.c_str());
37 wxLogWarning(buf);
38 return;
39 }
40
41 logfile->SetPath("/InstallLog");
42 if (logfile->Exists("Version") &&
43 logfile->Read("Version", 0l) != LOGFILE_VERSION )
44 {
45 buf.Printf(_("Logfile version mismatch: %s"), logname.c_str() );
46 wxLogWarning(buf);
47 delete logfile;
48 return;
49 }
50
51 logfile->Write("Version", LOGFILE_VERSION);
52 dirtyflag = false;
53}
54
55InstallLog::~InstallLog()
56{
57 if (dirtyflag) return;
58
59 delete logfile;
60}
61
62unsigned int InstallLog::WriteFile(wxString filepath, bool isDir)
63{
64 wxString key, buf;
65 long installcount = 0;
66
67 if (dirtyflag) return true;
68
69 filepath.Replace(PATH_SEP, wxT("/") );
70
71 if (filepath.GetChar(0) == '/')
72 filepath = filepath.Right(filepath.Len() - 1);
73
74 logfile->SetPath(wxT("/FilePaths"));
75 installcount = logfile->Read(filepath, 0l);
76
77 if (isDir)
78 {
79 filepath.Append(wxT("/" DIRECTORY_KLUDGE) ); // Needed for empty dirs
80 }
81
82 logfile->Write(filepath, ++installcount);
83
84 return false;
85}
86
87unsigned int InstallLog::WriteFile(wxArrayString filepaths)
88{
89 unsigned long i;
90 unsigned int finalrc = false;
91 wxString thisone;
92
93 if (dirtyflag) return true;
94
95 for (i = 0; i < filepaths.GetCount(); i++);
96 {
97 if ( WriteFile(filepaths[i]) )
98 {
99 finalrc++;
100 }
101 }
102
103 return finalrc;
104}
105
106wxArrayString* InstallLog::GetInstalledFiles()
107{
108 wxString curdir = "";
109
110 if (dirtyflag) return NULL;
111 workingAS.Clear();
112
113 EnumerateCurDir("");
114
115 wxArrayString* out = new wxArrayString(workingAS);
116 return out;
117}
118
119void InstallLog::EnumerateCurDir(wxString curdir)
120{
121 bool contflag;
122 wxString curname, buf, buf2, pathcache;
123 long dummy;
124
125 buf.Printf(wxT("/FilePaths/%s"), curdir.c_str());
126 pathcache = logfile->GetPath();
127 logfile->SetPath(buf);
128
129 contflag = logfile->GetFirstGroup(curname, dummy);
130 while (contflag)
131 {
132 buf.Printf("%s/%s", curdir.c_str(), curname.c_str() );
133 buf2 = buf; buf2.Replace(wxT("/"), wxT(PATH_SEP));
134 workingAS.Add(buf2);
135 EnumerateCurDir(buf);
136 contflag = logfile->GetNextGroup(curname, dummy);
137 }
138
139 contflag = logfile->GetFirstEntry(curname, dummy);
140 while (contflag)
141 {
142 if (curname != wxT(DIRECTORY_KLUDGE) )
143 {
144 buf.Printf("%s/%s", curdir.c_str(), curname.c_str() );
145 buf2 = buf; buf2.Replace(wxT("/"), wxT(PATH_SEP));
146 workingAS.Add(buf2);
147 }
148 contflag = logfile->GetNextEntry(curname, dummy);
149 }
150
151 logfile->SetPath(pathcache);
152}
153
diff --git a/rbutil/installlog.h b/rbutil/installlog.h
new file mode 100644
index 0000000000..cb85e08359
--- /dev/null
+++ b/rbutil/installlog.h
@@ -0,0 +1,61 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * Module: rbutil
9 * File: installlog.h
10 *
11 * Copyright (C) 2006 Christi Alice Scarborough
12 *
13 * All files in this archive are subject to the GNU General Public License.
14 * See the file COPYING in the source tree root for full license agreement.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20
21
22#ifndef INSTALLLOG_H_INCLUDED
23#define INSTALLLOG_H_INCLUDED
24
25#include <wx/wxprec.h>
26#ifdef __BORLANDC__
27 #pragma hdrstop
28#endif
29#ifndef WX_PRECOMP
30 #include <wx/wx.h>
31#endif
32
33#include <wx/confbase.h>
34#include <wx/fileconf.h>
35
36#define LOGFILE_VERSION 1
37#define DIRECTORY_KLUDGE "_DIRECTORY_MARKER_RECORD_KLUDGE_"
38class InstallLog
39{
40 // Class variables
41 wxFileConfig* logfile;
42
43 // Methods
44 public:
45 InstallLog(wxString logname, bool CreateLog = true);
46 ~InstallLog();
47 unsigned int WriteFile(wxString filepath, bool isDir = false);
48 unsigned int WriteFile(wxArrayString filepaths);
49 wxArrayString* GetInstalledFiles();
50
51 private:
52 bool dirtyflag;
53 wxArrayString workingAS;
54// long dummy;
55
56 private:
57 void EnumerateCurDir(wxString curdir);
58}; // InstallLog
59
60
61#endif // INSTALLLOG_H_INCLUDED
diff --git a/rbutil/rbutil-rc.rc b/rbutil/rbutil-rc.rc
index 13513fb2fc..986bd583b4 100644
--- a/rbutil/rbutil-rc.rc
+++ b/rbutil/rbutil-rc.rc
@@ -1,8 +1,8 @@
1#define RBUTIL 1 1#define RBUTIL 1
2#include <wx/msw/wx.rc> 2#include <wx/msw/wx.rc>
3RBUTIL VERSIONINFO 3RBUTIL VERSIONINFO
4FILEVERSION 0,2,0,0 4FILEVERSION 0,2,1,0
5PRODUCTVERSION 0,2,0,0 5PRODUCTVERSION 0,2,1,0
6FILEOS 0x00000004 6FILEOS 0x00000004
7FILETYPE 0x00000001 7FILETYPE 0x00000001
8BEGIN 8BEGIN
@@ -10,12 +10,12 @@ BEGIN
10 BEGIN 10 BEGIN
11 BLOCK "FFFF0000" 11 BLOCK "FFFF0000"
12 BEGIN 12 BEGIN
13 VALUE "FileVersion", "0.2.0.0\0" 13 VALUE "FileVersion", "0.2.1.0\0"
14 VALUE "ProductVersion", "0.2.0.0\0" 14 VALUE "ProductVersion", "0.2.1.0\0"
15 VALUE "CompanyName", "Rockbox Team\0" 15 VALUE "CompanyName", "Rockbox Team\0"
16 VALUE "FileDescription", "Rockbox Utility\0" 16 VALUE "FileDescription", "Rockbox Utility\0"
17 VALUE "InternalName", "rbutil\0" 17 VALUE "InternalName", "rbutil\0"
18 VALUE "LegalCopyright", "(C) 2005,5 Rockbox Team\0" 18 VALUE "LegalCopyright", "(C) 2005,6 Rockbox Team\0"
19 VALUE "ProductName", "Rockbox Utility\0" 19 VALUE "ProductName", "Rockbox Utility\0"
20 END 20 END
21 END 21 END
diff --git a/rbutil/rbutil.cpp b/rbutil/rbutil.cpp
index 4344690d01..0adee683ec 100644
--- a/rbutil/rbutil.cpp
+++ b/rbutil/rbutil.cpp
@@ -19,6 +19,7 @@
19 ****************************************************************************/ 19 ****************************************************************************/
20 20
21#include "rbutil.h" 21#include "rbutil.h"
22#include "installlog.h"
22 23
23// This class allows us to return directories as well as files to 24// This class allows us to return directories as well as files to
24// wxDir::Traverse 25// wxDir::Traverse
@@ -195,9 +196,11 @@ int DownloadURL(wxString src, wxString dest)
195 196
196int UnzipFile(wxString src, wxString destdir, bool isInstall) 197int UnzipFile(wxString src, wxString destdir, bool isInstall)
197{ 198{
198 wxZipEntryPtr entry; 199 wxZipEntryPtr entry;
199 wxString in_str, progress_msg, buf, logfile = wxT(""); 200 wxString in_str, progress_msg, buf;
200 int errnum = 0, curfile = 0, totalfiles = 0; 201 int errnum = 0, curfile = 0, totalfiles = 0;
202 InstallLog* log = NULL;
203
201 wxLogVerbose(_("===begin UnzipFile(%s,%s,%i)"), 204 wxLogVerbose(_("===begin UnzipFile(%s,%s,%i)"),
202 src.c_str(), destdir.c_str(), isInstall); 205 src.c_str(), destdir.c_str(), isInstall);
203 206
@@ -245,6 +248,13 @@ int UnzipFile(wxString src, wxString destdir, bool isInstall)
245 wxPD_REMAINING_TIME | wxPD_CAN_ABORT); 248 wxPD_REMAINING_TIME | wxPD_CAN_ABORT);
246 progress->Update(0); 249 progress->Update(0);
247 250
251 // We're not overly worried if the logging fails
252 if (isInstall)
253 {
254 buf.Printf(wxT("%s" PATH_SEP UNINSTALL_FILE), destdir.c_str());
255 log = new InstallLog(buf);
256 }
257
248 while (! errnum && 258 while (! errnum &&
249 (entry.reset(in_zip->GetNextEntry()), entry.get() != NULL) ) 259 (entry.reset(in_zip->GetNextEntry()), entry.get() != NULL) )
250 { 260 {
@@ -260,15 +270,11 @@ int UnzipFile(wxString src, wxString destdir, bool isInstall)
260 } 270 }
261 271
262 in_str.Printf(wxT("%s" PATH_SEP "%s"), destdir.c_str(), name.c_str()); 272 in_str.Printf(wxT("%s" PATH_SEP "%s"), destdir.c_str(), name.c_str());
263 buf = logfile;
264 // We leave space for adding a future CRC check, if we ever
265 // feel particularly enthunsiastic.
266 logfile.Printf(wxT("0 %s\n%s"), name.c_str(), buf.c_str());
267 273
268 if (entry->IsDir() ) { 274 if (entry->IsDir() ) {
269 wxDir* dirname = new wxDir(in_str); 275 wxDir* dirname = new wxDir(in_str);
270 if (! dirname->Exists(in_str) ) { 276 if (! dirname->Exists(in_str) ) {
271 if (wxMkDir(in_str, 0777) ) { 277 if (! wxMkdir(in_str, 0777) ) {
272 buf.Printf(_("Unable to create directory %s"), 278 buf.Printf(_("Unable to create directory %s"),
273 in_str.c_str() ); 279 in_str.c_str() );
274 errnum = 100; 280 errnum = 100;
@@ -276,6 +282,7 @@ int UnzipFile(wxString src, wxString destdir, bool isInstall)
276 break; 282 break;
277 } 283 }
278 } 284 }
285 log->WriteFile(name, true); // Directory
279 delete dirname; 286 delete dirname;
280 continue; 287 continue;
281 } 288 }
@@ -286,6 +293,9 @@ int UnzipFile(wxString src, wxString destdir, bool isInstall)
286 buf.Printf(_("Can't open file %s for writing"), in_str.c_str() ); 293 buf.Printf(_("Can't open file %s for writing"), in_str.c_str() );
287 delete out; 294 delete out;
288 return 100; 295 return 100;
296 } else if (isInstall)
297 {
298 log->WriteFile(name);
289 } 299 }
290 300
291 in_zip->Read(*out); 301 in_zip->Read(*out);
@@ -316,21 +326,9 @@ int UnzipFile(wxString src, wxString destdir, bool isInstall)
316 if (errnum) 326 if (errnum)
317 { 327 {
318 ERR_DIALOG(buf, _("Unzip File")); 328 ERR_DIALOG(buf, _("Unzip File"));
319 } else if (isInstall)
320 {
321 // If this fails, we have no log. No biggie.
322 buf = logfile;
323 logfile.Printf(wxT("%s " PATH_SEP "\n%s"), gv->curplat.c_str(),
324 buf.c_str());
325
326 buf.Printf(wxT("%s" PATH_SEP UNINSTALL_FILE),
327 destdir.c_str());
328 wxFFileOutputStream* out = new wxFFileOutputStream(buf);
329 out->Write(logfile, logfile.Len());
330 out->Close();
331 delete out;
332 } 329 }
333 330
331 if (log) delete log;
334 wxLogVerbose(_("=== end UnzipFile")); 332 wxLogVerbose(_("=== end UnzipFile"));
335 return(errnum); 333 return(errnum);
336} 334}
@@ -340,6 +338,8 @@ int Uninstall(const wxString dir, bool isFullUninstall) {
340 bool gooddata = false; 338 bool gooddata = false;
341 unsigned int i; 339 unsigned int i;
342 bool errflag = false; 340 bool errflag = false;
341 InstallLog *log = NULL;
342 wxArrayString* FilesToRemove = NULL;
343 343
344 wxLogVerbose(_("=== begin Uninstall(%s,%i)"), dir.c_str(), isFullUninstall); 344 wxLogVerbose(_("=== begin Uninstall(%s,%i)"), dir.c_str(), isFullUninstall);
345 345
@@ -351,25 +351,13 @@ int Uninstall(const wxString dir, bool isFullUninstall) {
351 351
352 if (! isFullUninstall) 352 if (! isFullUninstall)
353 { 353 {
354 buf.Printf(wxT("%s" PATH_SEP UNINSTALL_FILE), dir.c_str());
355 if ( wxFileExists(buf) )
356 {
357 wxFFileInputStream* uninst_data = new wxFFileInputStream(buf);
358 if (uninst_data->Ok() )
359 {
360 wxStringOutputStream* out = new wxStringOutputStream(&uninst);
361 uninst_data->Read(*out);
362 if (uninst_data->GetLastError() == wxSTREAM_EOF &&
363 ! out->GetLastError() )
364 {
365 gooddata = true;
366 }
367 delete out;
368 }
369 delete uninst_data;
370 }
371 354
372 if (! gooddata) { 355 buf.Printf(wxT("%s" PATH_SEP UNINSTALL_FILE), dir.c_str());
356 log = new InstallLog(buf, false); // Don't create the log
357 FilesToRemove = log->GetInstalledFiles();
358 if (log) delete log;
359
360 if (FilesToRemove == NULL || FilesToRemove->GetCount() < 1) {
373 wxLogNull lognull; 361 wxLogNull lognull;
374 if ( wxMessageDialog(NULL, 362 if ( wxMessageDialog(NULL,
375 _("Rockbox Utility can't find any uninstall data on this " 363 _("Rockbox Utility can't find any uninstall data on this "
@@ -439,25 +427,16 @@ int Uninstall(const wxString dir, bool isFullUninstall) {
439 { 427 {
440 wxString instplat, this_path_sep; 428 wxString instplat, this_path_sep;
441 unsigned int totalfiles, rc; 429 unsigned int totalfiles, rc;
430 totalfiles = FilesToRemove->GetCount();
431 FilesToRemove->Sort(true); // Reverse alphabetical ie dirs after files
442 432
443 // First line is "<platform><space><path seperator>\n" 433 for (i = 0; i < totalfiles; i++)
444 instplat = uninst.BeforeFirst(wxT(' '));
445 this_path_sep = uninst.AfterFirst(wxT(' ')).BeforeFirst(wxT('\n'));
446 uninst = uninst.AfterFirst(wxT('\n'));
447 totalfiles = uninst.Freq(wxT('\n'));
448
449 i = 0;
450 while ((buf = uninst.BeforeFirst(wxT('\n'))) != "" )
451 { 434 {
452 // These lines are all "<crc (unused)><space><filename>\n"
453 buf = buf.AfterFirst(wxT(' '));
454 buf = buf.Format(wxT("%s" PATH_SEP "%s"), dir.c_str(), buf.c_str());
455 // So we can install under Linux and still uninstall under Win
456 buf.Replace(this_path_sep, PATH_SEP);
457
458 wxString* buf2 = new wxString; 435 wxString* buf2 = new wxString;
436 buf.Printf("%s%s", dir.c_str() , FilesToRemove->Item(i).c_str() );
459 buf2->Format(_("Deleting %s"), buf.c_str()); 437 buf2->Format(_("Deleting %s"), buf.c_str());
460 if (! progress->Update(++i * 100 / totalfiles, *buf2) ) 438
439 if (! progress->Update((i + 1) * 100 / totalfiles, *buf2) )
461 { 440 {
462 WARN_DIALOG(_("Cancelled by user"), _("Normal Uninstall")); 441 WARN_DIALOG(_("Cancelled by user"), _("Normal Uninstall"));
463 delete progress; 442 delete progress;
@@ -468,7 +447,7 @@ int Uninstall(const wxString dir, bool isFullUninstall) {
468 { 447 {
469 // If we're about to attempt to remove .rockbox. delete 448 // If we're about to attempt to remove .rockbox. delete
470 // install data first 449 // install data first
471 buf2->Printf(wxT("%s" PATH_SEP ".rockbox" PATH_SEP), dir.c_str() ); 450 buf2->Printf(wxT("%s" PATH_SEP ".rockbox"), dir.c_str() );
472 if ( buf.IsSameAs(buf2->c_str()) ) 451 if ( buf.IsSameAs(buf2->c_str()) )
473 { 452 {
474 buf2->Printf(wxT("%s" PATH_SEP UNINSTALL_FILE), dir.c_str()); 453 buf2->Printf(wxT("%s" PATH_SEP UNINSTALL_FILE), dir.c_str());
@@ -503,10 +482,12 @@ int Uninstall(const wxString dir, bool isFullUninstall) {
503 } 482 }
504 if (errflag) 483 if (errflag)
505 { 484 {
506 ERR_DIALOG(_("Unable to remove some files"), 485 ERR_DIALOG(_("Unable to remove some files"),
507 _("Standard uninstall")) ; 486 _("Standard uninstall")) ;
508 } 487 }
509 } 488
489 if (FilesToRemove != NULL) delete FilesToRemove;
490 }
510 491
511 delete progress; 492 delete progress;
512 wxLogVerbose(_("=== end Uninstall")); 493 wxLogVerbose(_("=== end Uninstall"));
@@ -541,21 +522,35 @@ wxString stream_err_str(int errnum)
541bool InstallRbutil(wxString dest) 522bool InstallRbutil(wxString dest)
542{ 523{
543 wxArrayString filestocopy; 524 wxArrayString filestocopy;
544 wxString str, buf, dstr, destdir; 525 wxString str, buf, dstr, localpath, destdir;
545 unsigned int i; 526 unsigned int i;
546 wxDir dir; 527 wxDir dir;
547 bool copied_exe = false; 528 bool copied_exe = false, made_rbdir = false;
529 InstallLog* log;
530
531 buf.Printf(wxT("%s" PATH_SEP ".rockbox"), dest.c_str() );
532
533 if (! wxDirExists(buf) )
534 {
535 wxMkdir(buf);
536 made_rbdir = true;
537 }
538
539 buf.Printf(wxT("%s" PATH_SEP UNINSTALL_FILE), dest.c_str() );
540 log = new InstallLog(buf);
541 if (made_rbdir) log->WriteFile(wxT(".rockbox"), true);
548 542
549 destdir.Printf(wxT("%s" PATH_SEP "RockboxUtility"), dest.c_str()); 543 destdir.Printf(wxT("%s" PATH_SEP "RockboxUtility"), dest.c_str());
550 if (! wxDirExists(destdir) ) 544 if (! wxDirExists(destdir) )
551 { 545 {
552 if (! wxMkdir(destdir) ) 546 if (! wxMkdir(destdir, 0777) )
553 { 547 {
554 buf.Printf(wxT("%s (%s)"), 548 buf.Printf(wxT("%s (%s)"),
555 _("Unable to create directory for installer"), destdir.c_str()); 549 _("Unable to create directory for installer"), destdir.c_str());
556 WARN_DIALOG(buf , _("Portable install") ); 550 WARN_DIALOG(buf , _("Portable install") );
557 return false; 551 return false;
558 } 552 }
553 log->WriteFile(wxT("RockboxUtility"), true);
559 } 554 }
560 555
561 dir.GetAllFiles(gv->ResourceDir, &filestocopy, wxT("*"), 556 dir.GetAllFiles(gv->ResourceDir, &filestocopy, wxT("*"),
@@ -583,6 +578,9 @@ bool InstallRbutil(wxString dest)
583 WARN_DIALOG(buf, _("Portable Install") ); 578 WARN_DIALOG(buf, _("Portable Install") );
584 return false; 579 return false;
585 } 580 }
581 buf = dstr;
582 buf.Replace(dest, wxEmptyString, false);
583 log->WriteFile(buf);
586 } 584 }
587 585
588 if (! copied_exe) 586 if (! copied_exe)
@@ -597,6 +595,9 @@ bool InstallRbutil(wxString dest)
597 WARN_DIALOG(buf, _("Portable Install") ); 595 WARN_DIALOG(buf, _("Portable Install") );
598 return false; 596 return false;
599 } 597 }
598 buf = dstr;
599 buf.Replace(dest, wxEmptyString, false);
600 log->WriteFile(buf);
600 } 601 }
601 602
602 // Copy the local ini file so that it knows that it's a portable copy 603 // Copy the local ini file so that it knows that it's a portable copy
@@ -610,7 +611,11 @@ bool InstallRbutil(wxString dest)
610 WARN_DIALOG(buf, _("Portable Install") ); 611 WARN_DIALOG(buf, _("Portable Install") );
611 return false; 612 return false;
612 } 613 }
614 buf = dstr;
615 buf.Replace(dest, wxEmptyString, false);
616 log->WriteFile(buf);
613 617
618 delete log;
614 return true; 619 return true;
615} 620}
616 621
diff --git a/rbutil/rbutil.iss b/rbutil/rbutil.iss
index 0f7ae04708..d945d85336 100644
--- a/rbutil/rbutil.iss
+++ b/rbutil/rbutil.iss
@@ -2,7 +2,7 @@
2; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! 2; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
3 3
4#define MyAppName "Rockbox Utility" 4#define MyAppName "Rockbox Utility"
5#define MyAppVerName "Rockbox Utility v0.2" 5#define MyAppVerName "Rockbox Utility v0.2.1"
6#define MyAppPublisher "Rockbox Team" 6#define MyAppPublisher "Rockbox Team"
7#define MyAppURL "http://www.rockbox.org/" 7#define MyAppURL "http://www.rockbox.org/"
8#define MyAppExeName "rbutil.exe" 8#define MyAppExeName "rbutil.exe"
@@ -17,8 +17,8 @@ AppSupportURL={#MyAppURL}
17AppUpdatesURL={#MyAppURL} 17AppUpdatesURL={#MyAppURL}
18DefaultDirName={pf}\{#MyAppName} 18DefaultDirName={pf}\{#MyAppName}
19DefaultGroupName={#MyAppName} 19DefaultGroupName={#MyAppName}
20LicenseFile=C:\Documents and Settings\christi\My Documents\devel\rbutil\copying.txt 20LicenseFile=copying.txt
21OutputBaseFilename=rbutil-0.2-setup 21OutputBaseFilename=rbutil-0.2.1-setup
22Compression=lzma/ultra 22Compression=lzma/ultra
23SolidCompression=true 23SolidCompression=true
24OutputDir=. 24OutputDir=.
diff --git a/rbutil/rbutilApp.cpp b/rbutil/rbutilApp.cpp
index ef18af0d53..8b7a722a1e 100644
--- a/rbutil/rbutilApp.cpp
+++ b/rbutil/rbutilApp.cpp
@@ -216,6 +216,7 @@ void rbutilFrmApp::ReadUserConfig()
216 216
217 gv->UserConfig = new wxFileConfig(wxEmptyString, wxEmptyString, buf); 217 gv->UserConfig = new wxFileConfig(wxEmptyString, wxEmptyString, buf);
218 gv->UserConfigFile = buf; 218 gv->UserConfigFile = buf;
219 gv->UserConfig->Set(gv->UserConfig); // Store wxWidgets internal settings
219 stack = gv->UserConfig->GetPath(); 220 stack = gv->UserConfig->GetPath();
220 221
221 gv->UserConfig->SetPath(wxT("/defaults")); 222 gv->UserConfig->SetPath(wxT("/defaults"));
diff --git a/rbutil/rbutilApp.h b/rbutil/rbutilApp.h
index bac6dc2c32..b20e39eb90 100644
--- a/rbutil/rbutilApp.h
+++ b/rbutil/rbutilApp.h
@@ -1,10 +1,22 @@
1//--------------------------------------------------------------------------- 1/***************************************************************************
2// 2 * __________ __ ___.
3// Name: rbutilApp.h 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4// Author: Christi Scarborough 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5// Created: 03/12/2005 00:35:02 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6// 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7//--------------------------------------------------------------------------- 7 * \/ \/ \/ \/ \/
8 * Module: rbutil
9 * File: rbutilApp.h
10 *
11 * Copyright (C) 2005 Christi Alice Scarborough
12 *
13 * All files in this archive are subject to the GNU General Public License.
14 * See the file COPYING in the source tree root for full license agreement.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
8 20
9#include <wx/wxprec.h> 21#include <wx/wxprec.h>
10#ifdef __BORLANDC__ 22#ifdef __BORLANDC__
diff --git a/rbutil/rbutilFrm.cpp b/rbutil/rbutilFrm.cpp
index 09e94a04b3..49ff6248b5 100644
--- a/rbutil/rbutilFrm.cpp
+++ b/rbutil/rbutilFrm.cpp
@@ -259,7 +259,7 @@ void rbutilFrm::OnFileWipeCache(wxCommandEvent& event)
259 MESG_DIALOG(_("Errors occured deleting the local download cache.")); 259 MESG_DIALOG(_("Errors occured deleting the local download cache."));
260 } 260 }
261 261
262 wxMkDir(cacheloc, 0777); 262 wxMkdir(cacheloc, 0777);
263} 263}
264 264
265 265
@@ -416,7 +416,16 @@ void rbutilFrm::OnFontBtn(wxCommandEvent& event)
416 416
417 if (wizard->RunWizard(page1) ) 417 if (wizard->RunWizard(page1) )
418 { 418 {
419 dest.Printf("%s" PATH_SEP "download" PATH_SEP "build-info", 419 buf.Printf(wxT("%s" PATH_SEP ".rockbox"), gv->curdestdir.c_str()) ;
420 if (! wxDirExists(buf) )
421 {
422 buf.Printf(_("Rockbox is not yet installed on %s - install "
423 "Rockbox first."), buf.c_str() );
424 WARN_DIALOG(buf, _("Can't install fonts") );
425 return;
426 }
427
428 dest.Printf(wxT("%s" PATH_SEP "download" PATH_SEP "build-info"),
420 gv->stdpaths->GetUserDataDir().c_str()); 429 gv->stdpaths->GetUserDataDir().c_str());
421 if (DownloadURL(gv->server_conf_url, dest)) 430 if (DownloadURL(gv->server_conf_url, dest))
422 { 431 {
@@ -463,7 +472,7 @@ void rbutilFrm::OnFontBtn(wxCommandEvent& event)
463 } 472 }
464 } 473 }
465 474
466 if ( !UnzipFile(dest, gv->curdestdir) ) 475 if ( !UnzipFile(dest, gv->curdestdir, true) )
467 { 476 {
468 MESG_DIALOG(_("The Rockbox fonts have been installed on your device.") ); 477 MESG_DIALOG(_("The Rockbox fonts have been installed on your device.") );
469 } else 478 } else
diff --git a/rbutil/wizard_pages.cpp b/rbutil/wizard_pages.cpp
index 29aafffed7..7cd38cf004 100644
--- a/rbutil/wizard_pages.cpp
+++ b/rbutil/wizard_pages.cpp
@@ -1,3 +1,23 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * Module: rbutil
9 * File: wizardpages.cpp
10 *
11 * Copyright (C) 2005 Christi Alice Scarborough
12 *
13 * All files in this archive are subject to the GNU General Public License.
14 * See the file COPYING in the source tree root for full license agreement.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20
1#include "wizard_pages.h" 21#include "wizard_pages.h"
2 22
3wxPlatformPage::wxPlatformPage(wxWizard *parent) : wxWizardPageSimple(parent) 23wxPlatformPage::wxPlatformPage(wxWizard *parent) : wxWizardPageSimple(parent)
diff --git a/rbutil/wizard_pages.h b/rbutil/wizard_pages.h
index 6fa6b88034..d0fd4459e0 100644
--- a/rbutil/wizard_pages.h
+++ b/rbutil/wizard_pages.h
@@ -1,3 +1,24 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * Module: rbutil
9 * File: wizard_pages.h
10 *
11 * Copyright (C) 2005 Christi Alice Scarborough
12 *
13 * All files in this archive are subject to the GNU General Public License.
14 * See the file COPYING in the source tree root for full license agreement.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20
21
1#ifndef __wizard_pages_HPP_ 22#ifndef __wizard_pages_HPP_
2#define __wizard_pages_HPP_ 23#define __wizard_pages_HPP_
3 24
diff --git a/rbutil/wx_pch.h b/rbutil/wx_pch.h
index a8514fde56..c4da9a20ef 100644
--- a/rbutil/wx_pch.h
+++ b/rbutil/wx_pch.h
@@ -1,3 +1,23 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * Module: rbutil
9 * File: wx_pch.h
10 *
11 * Copyright (C) 2005 wxWidgets team
12 *
13 * All files in this archive are subject to the GNU General Public License.
14 * See the file COPYING in the source tree root for full license agreement.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20
1#ifndef WX_PCH_H_INCLUDED 21#ifndef WX_PCH_H_INCLUDED
2#define WX_PCH_H_INCLUDED 22#define WX_PCH_H_INCLUDED
3 23