libroot: fix path inconsistency in the find path API.

With the package kit merge, settings from packages were
placed into ~/config/settings/global for packages installed
into the PackageFS Home mount.

As a result, B_FIND_PATH_SETTINGS_DIRECTORY was returning a
user settings path different to the find directory API, making
transitioning from find directory to find path incompatible.

This change also updates the package_daemon and packagefs
to remove the remapping also occurring there.

Change-Id: Id5d077503e177a5f7cbc48779c132160b0d01890
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5941
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Jessica Hamilton
2023-04-08 15:54:33 +00:00
committed by waddlesplash
parent d8eeb8a4cc
commit 8079adc050
3 changed files with 3 additions and 15 deletions
@@ -29,7 +29,7 @@ static const char* const kLinkPaths[PackageLinkSymlink::TYPE_ENUM_COUNT]
},
{
"../../../system/settings",
"../../../home/config/settings/global",
"../../../home/config/settings",
kUnknownLinkTarget
}
};
@@ -878,18 +878,6 @@ CommitTransactionHandler::_AddGlobalWritableFile(Package* package,
const BGlobalWritableFileInfo& file, const BDirectory& rootDirectory,
const BDirectory& extractedFilesDirectory)
{
// Map the path name to the actual target location. Currently this only
// concerns "settings/", which is mapped to "settings/global/".
BString targetPath(file.Path());
if (fVolume->MountType() == PACKAGE_FS_MOUNT_TYPE_HOME) {
if (targetPath == "settings"
|| targetPath.StartsWith("settings/")) {
targetPath.Insert("/global", 8);
if (targetPath.Length() == file.Path().Length())
throw std::bad_alloc();
}
}
// open parent directory of the source entry
const char* lastSlash = strrchr(file.Path(), '/');
const BDirectory* sourceDirectory;
@@ -916,6 +904,7 @@ CommitTransactionHandler::_AddGlobalWritableFile(Package* package,
}
// open parent directory of the target entry -- create, if necessary
BString targetPath(file.Path());
FSUtils::Path relativeSourcePath(file.Path());
lastSlash = strrchr(targetPath, '/');
if (lastSlash != NULL) {
+1 -2
View File
@@ -216,8 +216,7 @@ get_relative_directory_path(size_t installationLocationIndex,
case B_FIND_PATH_SERVERS_DIRECTORY:
return "/servers";
case B_FIND_PATH_SETTINGS_DIRECTORY:
return installationLocationIndex == kHomeInstallationLocationIndex
? "/settings/global" : "/settings";
return "/settings";
case B_FIND_PATH_SOUNDS_DIRECTORY:
return "/data/sounds";
case B_FIND_PATH_SPOOL_DIRECTORY: