PackageInstaller: Dynamically replace /boot/system with the system non-packaged dir, same with ~/config
This commit is contained in:
parent
7c1acc8968
commit
c45fe1f8f7
@ -15,6 +15,7 @@
|
||||
#include <ByteOrder.h>
|
||||
#include <Catalog.h>
|
||||
#include <Directory.h>
|
||||
#include <FindDirectory.h>
|
||||
#include <fs_info.h>
|
||||
#include <Locale.h>
|
||||
#include <NodeInfo.h>
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user