diff --git a/src/apps/installer/CopyEngine.cpp b/src/apps/installer/CopyEngine.cpp index fb297f0df9..437046ca9d 100644 --- a/src/apps/installer/CopyEngine.cpp +++ b/src/apps/installer/CopyEngine.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -62,6 +63,11 @@ 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()); } @@ -231,7 +237,7 @@ CopyEngine::_CollectCopyInfo(const char* _source, int32& level, if (ret < B_OK) return ret; - if (!_ShouldCopyEntry(name, statInfo, level)) + if (!_ShouldCopyEntry(entry, name, statInfo, level)) continue; if (S_ISDIR(statInfo.st_mode)) { @@ -302,7 +308,7 @@ CopyEngine::_CopyFolder(const char* _source, const char* _destination, struct stat statInfo; entry.GetStat(&statInfo); - if (!_ShouldCopyEntry(name, statInfo, level)) + if (!_ShouldCopyEntry(entry, name, statInfo, level)) continue; fItemsCopied++; @@ -490,11 +496,12 @@ CopyEngine::_UpdateProgress() bool -CopyEngine::_ShouldCopyEntry(const char* name, const struct stat& statInfo, - int32 level) const +CopyEngine::_ShouldCopyEntry(const BEntry& entry, const char* name, + const struct stat& statInfo, int32 level) const { if (level == 1 && S_ISDIR(statInfo.st_mode)) { if (strcmp(VAR_DIRECTORY, name) == 0) { + // old location of /boot/var printf("ignoring '%s'.\n", name); return false; } @@ -517,6 +524,11 @@ CopyEngine::_ShouldCopyEntry(const char* name, const struct stat& statInfo, return false; } } + if (fVarDirectory == entry) { + // current location of var + printf("ignoring '%s'.\n", name); + return false; + } return true; } diff --git a/src/apps/installer/CopyEngine.h b/src/apps/installer/CopyEngine.h index a82d1b9e55..f3af92f771 100644 --- a/src/apps/installer/CopyEngine.h +++ b/src/apps/installer/CopyEngine.h @@ -42,7 +42,8 @@ private: const char* destination, int32& level, sem_id cancelSemaphore); - bool _ShouldCopyEntry(const char* name, + bool _ShouldCopyEntry(const BEntry& entry, + const char* name, const struct stat& statInfo, int32 level) const; @@ -106,6 +107,9 @@ private: const char* fCurrentItem; ProgressReporter* fProgressReporter; + + // TODO: Should be made into a list of BEntris to be ignored, perhaps. + BEntry fVarDirectory; };