CopyEngine is a BLooper: let it delete itself ...

copy everything in source directory instead of just 'beos'


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16040 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2006-01-22 23:32:55 +00:00
parent ca9db3588c
commit 0bd6170f79
3 changed files with 19 additions and 11 deletions
+12 -5
View File
@@ -158,11 +158,18 @@ CopyEngine::Start(BMenu *srcMenu, BMenu *targetMenu)
// copy source volume // copy source volume
BDirectory targetDir(targetDirectory.Path()); BDirectory targetDir(targetDirectory.Path());
srcDirectory.Append("beos"); BDirectory srcDir(srcDirectory.Path());
BEntry srcEntry(srcDirectory.Path()); BEntry entry;
Undo undo; status_t status;
printf("Copying folder '%s' to '%s'.\n", srcDirectory.Path(), targetDirectory.Path()); while (srcDir.GetNextEntry(&entry) == B_OK) {
FSCopyFolder(&srcEntry, &targetDir, fControl, NULL, false, undo); Undo undo;
status = FSCopyFolder(&entry, &targetDir, fControl, NULL, false, undo);
if (status != B_OK) {
BPath path;
entry.GetPath(&path);
fprintf(stderr, "error while copying %s : %s\n", path.Path(), strerror(status));
}
}
// copy selected packages // copy selected packages
+6 -5
View File
@@ -64,9 +64,10 @@ LogoView::Draw(BRect update)
InstallerWindow::InstallerWindow(BRect frame_rect) InstallerWindow::InstallerWindow(BRect frame_rect)
: BWindow(frame_rect, "Installer", B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE), : BWindow(frame_rect, "Installer", B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE),
fDriveSetupLaunched(false), fDriveSetupLaunched(false)
fCopyEngine(this)
{ {
fCopyEngine = new CopyEngine(this);
BRect bounds = Bounds(); BRect bounds = Bounds();
bounds.bottom += 1; bounds.bottom += 1;
bounds.right += 1; bounds.right += 1;
@@ -164,7 +165,7 @@ InstallerWindow::MessageReceived(BMessage *msg)
StartScan(); StartScan();
break; break;
case BEGIN_MESSAGE: case BEGIN_MESSAGE:
BMessenger(&fCopyEngine).SendMessage(ENGINE_START); BMessenger(fCopyEngine).SendMessage(ENGINE_START);
break; break;
case SHOW_BOTTOM_MESSAGE: case SHOW_BOTTOM_MESSAGE:
ShowBottom(); ShowBottom();
@@ -217,7 +218,7 @@ InstallerWindow::QuitRequested()
return false; return false;
} }
be_app->PostMessage(B_QUIT_REQUESTED); be_app->PostMessage(B_QUIT_REQUESTED);
fCopyEngine.PostMessage(B_QUIT_REQUESTED); fCopyEngine->PostMessage(B_QUIT_REQUESTED);
return true; return true;
} }
@@ -280,7 +281,7 @@ InstallerWindow::StartScan()
while ((item = fDestMenu->RemoveItem((int32)0))) while ((item = fDestMenu->RemoveItem((int32)0)))
delete item; delete item;
fCopyEngine.ScanDisksPartitions(fSrcMenu, fDestMenu); fCopyEngine->ScanDisksPartitions(fSrcMenu, fDestMenu);
if (fSrcMenu->ItemAt(0)) { if (fSrcMenu->ItemAt(0)) {
PublishPackages(); PublishPackages();
+1 -1
View File
@@ -52,7 +52,7 @@ private:
BBitmap *fLogo; BBitmap *fLogo;
BPoint fDrawPoint; BPoint fDrawPoint;
CopyEngine fCopyEngine; CopyEngine *fCopyEngine;
}; };
#endif /* _InstallerWindow_h */ #endif /* _InstallerWindow_h */