From eb03c3798cf6bef1d1c27b330f2048b3f6e763bd Mon Sep 17 00:00:00 2001
From: Puck Meerburg <puck@puckipedia.nl>
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 2b5d53f..eda8368 100644
a
|
b
|
|
15 | 15 | #include <ByteOrder.h> |
16 | 16 | #include <Catalog.h> |
17 | 17 | #include <Directory.h> |
| 18 | #include <FindDirectory.h> |
18 | 19 | #include <fs_info.h> |
19 | 20 | #include <Locale.h> |
20 | 21 | #include <NodeInfo.h> |
… |
… |
PackageItem::InitPath(const char *path, BPath *destination)
|
204 | 205 | ret = destination->SetTo(mountPoint.Path(), fPath.String()); |
205 | 206 | } |
206 | 207 | |
| 208 | BPath systemNonPackagedDir; |
| 209 | find_directory(B_SYSTEM_NONPACKAGED_DIRECTORY, &systemNonPackagedDir); |
| 210 | |
| 211 | BPath userNonPackagedDir; |
| 212 | find_directory(B_USER_NONPACKAGED_DIRECTORY, &userNonPackagedDir); |
| 213 | |
| 214 | BString pathString(destination->Path()); |
| 215 | |
| 216 | // Hardcoded paths, the .pkg files hardcode this to the same |
| 217 | if (pathString.FindFirst("/boot/system") == 0 && pathString.FindFirst("non-packaged") == B_ERROR) { |
| 218 | pathString.Replace("/boot/system", systemNonPackagedDir.Path(), 1); |
| 219 | } |
| 220 | |
| 221 | if (pathString.FindFirst("/boot/home/config") == 0 && pathString.FindFirst("non-packaged") == B_ERROR) { |
| 222 | pathString.Replace("/boot/home/config", userNonPackagedDir.Path(), 1); |
| 223 | } |
| 224 | |
| 225 | destination->SetTo(pathString.String()); |
| 226 | |
207 | 227 | return ret; |
208 | 228 | } |
209 | 229 | |