Should fix #5806. CollectTargets() is also called for packages, the fVarDirectory init is moved to ResetTargets().

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36475 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2010-04-25 22:00:47 +00:00
parent cc393dbf74
commit 7f78035b8b
3 changed files with 18 additions and 20 deletions

View File

@ -79,7 +79,7 @@ CopyEngine::~CopyEngine()
void
CopyEngine::ResetTargets()
CopyEngine::ResetTargets(const char* source)
{
// TODO: One could subtract the bytes/items which were added to the
// ProgressReporter before resetting them...
@ -98,27 +98,25 @@ CopyEngine::ResetTargets()
fCurrentTargetFolder = NULL;
fCurrentItem = NULL;
// init BEntry pointing to /var
// There is no other way to retrieve the path to the var folder
// on the source volume. Using find_directory() with
// B_COMMON_VAR_DIRECTORY will only ever get the var folder on the
// current /boot volume regardless of the volume of "source", which
// makes sense, since passing a volume is meant to folders that are
// volume specific, like "trash".
BPath path(source);
if (path.Append("common/var") == B_OK)
fVarDirectory.SetTo(path.Path());
else
fVarDirectory.Unset();
}
status_t
CopyEngine::CollectTargets(const char* source, sem_id cancelSemaphore)
{
// init BEntry pointing to /var
{
// There is no other way to retrieve the path to the var folder
// on the source volume. Using find_directory() with
// B_COMMON_VAR_DIRECTORY will only ever get the var folder on the
// current /boot volume regardless of the volume of "source", which
// makes sense, since passing a volume is meant to folders that are
// volume specific, like "trash".
BPath path(source);
if (path.Append("common/var") == B_OK)
fVarDirectory.SetTo(path.Path());
else
fVarDirectory.Unset();
}
int32 level = 0;
status_t ret = _CollectCopyInfo(source, level, cancelSemaphore);
if (ret == B_OK && fProgressReporter != NULL)
@ -535,7 +533,7 @@ CopyEngine::_ShouldCopyEntry(const BEntry& entry, const char* name,
}
if (fVarDirectory == entry) {
// current location of var
printf("ignoring '%s'.\n", name);
printf("ignoring common/'%s'.\n", name);
return false;
}
return true;

View File

@ -23,7 +23,7 @@ public:
CopyEngine(ProgressReporter* reporter);
virtual ~CopyEngine();
void ResetTargets();
void ResetTargets(const char* source);
status_t CollectTargets(const char* source,
sem_id cancelSemaphore = -1);

View File

@ -382,12 +382,12 @@ WorkerThread::_PerformInstall(BMenu* srcMenu, BMenu* targetMenu)
goto error;
}
// Begin actuall installation
// Begin actual installation
_LaunchInitScript(targetDirectory);
// let the engine collect information for the progress bar later on
engine.ResetTargets();
engine.ResetTargets(srcDirectory.Path());
err = engine.CollectTargets(srcDirectory.Path(), fCancelSemaphore);
if (err != B_OK)
goto error;