From 51f50b12745c64a195c33857985f65de23a40249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Tue, 19 Jan 2010 19:21:48 +0000 Subject: [PATCH] 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 --- src/apps/installer/CopyEngine.cpp | 21 +++++++++++++++------ src/apps/installer/CopyEngine.h | 1 + 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/apps/installer/CopyEngine.cpp b/src/apps/installer/CopyEngine.cpp index 437046ca9d..0d711ccdb4 100644 --- a/src/apps/installer/CopyEngine.cpp +++ b/src/apps/installer/CopyEngine.cpp @@ -13,7 +13,6 @@ #include #include -#include #include #include #include @@ -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) diff --git a/src/apps/installer/CopyEngine.h b/src/apps/installer/CopyEngine.h index f3af92f771..9dfa3ddcbf 100644 --- a/src/apps/installer/CopyEngine.h +++ b/src/apps/installer/CopyEngine.h @@ -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; };