From c45fe1f8f71d44eaeb15ffa735ebba42e706a98a Mon Sep 17 00:00:00 2001 From: Puck Meerburg Date: Mon, 27 Jan 2014 19:08:06 +0000 Subject: [PATCH] PackageInstaller: Dynamically replace /boot/system with the system non-packaged dir, same with ~/config --- src/apps/packageinstaller/PackageItem.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/apps/packageinstaller/PackageItem.cpp b/src/apps/packageinstaller/PackageItem.cpp index 2b5d53fb43..eda8368086 100644 --- a/src/apps/packageinstaller/PackageItem.cpp +++ b/src/apps/packageinstaller/PackageItem.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -204,6 +205,25 @@ PackageItem::InitPath(const char *path, BPath *destination) ret = destination->SetTo(mountPoint.Path(), fPath.String()); } + BPath systemNonPackagedDir; + find_directory(B_SYSTEM_NONPACKAGED_DIRECTORY, &systemNonPackagedDir); + + BPath userNonPackagedDir; + find_directory(B_USER_NONPACKAGED_DIRECTORY, &userNonPackagedDir); + + BString pathString(destination->Path()); + + // Hardcoded paths, the .pkg files hardcode this to the same + if (pathString.FindFirst("/boot/system") == 0 && pathString.FindFirst("non-packaged") == B_ERROR) { + pathString.Replace("/boot/system", systemNonPackagedDir.Path(), 1); + } + + if (pathString.FindFirst("/boot/home/config") == 0 && pathString.FindFirst("non-packaged") == B_ERROR) { + pathString.Replace("/boot/home/config", userNonPackagedDir.Path(), 1); + } + + destination->SetTo(pathString.String()); + return ret; }