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; }