Installer cannot use find_directory(), since it needs to support source volumes

other than /boot. That's why it worked like it did in the first place. Some
folders like "trash" can be volume specific, but most others are not and the
volume passed to find_directory() is ignored (which makes sense).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35175 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2010-01-19 19:21:48 +00:00
parent 825566f82f
commit 51f50b1274
2 changed files with 16 additions and 6 deletions

View File

@ -13,7 +13,6 @@
#include <sys/resource.h>
#include <Directory.h>
#include <FindDirectory.h>
#include <fs_attr.h>
#include <NodeInfo.h>
#include <Path.h>
@ -63,11 +62,6 @@ CopyEngine::CopyEngine(ProgressReporter* reporter)
rl.rlim_cur = 512;
rl.rlim_max = RLIM_SAVED_MAX;
setrlimit(RLIMIT_NOFILE, &rl);
// init BEntry pointing to /var
BPath path;
if (find_directory(B_COMMON_VAR_DIRECTORY, &path) == B_OK)
fVarDirectory.SetTo(path.Path());
}
@ -110,6 +104,21 @@ CopyEngine::ResetTargets()
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)

View File

@ -109,6 +109,7 @@ private:
ProgressReporter* fProgressReporter;
// TODO: Should be made into a list of BEntris to be ignored, perhaps.
// settable by method...
BEntry fVarDirectory;
};