[haiku-commits] haiku: hrev46836 - src/apps/packageinstaller

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 7 Feb 2014 18:32:35 +0100 (CET)

hrev46836 adds 1 changeset to branch 'master'
old head: 7c1acc8968462eb1eb7719edd7b5af9a1f87f6aa
new head: c45fe1f8f71d44eaeb15ffa735ebba42e706a98a
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=c45fe1f+%5E7c1acc8

----------------------------------------------------------------------------

c45fe1f: PackageInstaller: Dynamically replace /boot/system with the system 
non-packaged dir, same with ~/config

                                      [ Puck Meerburg <puck@xxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev46836
Commit:      c45fe1f8f71d44eaeb15ffa735ebba42e706a98a
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c45fe1f
Author:      Puck Meerburg <puck@xxxxxxxxxxxxx>
Date:        Mon Jan 27 19:08:06 2014 UTC
Committer:   Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Commit-Date: Fri Feb  7 17:33:12 2014 UTC

----------------------------------------------------------------------------

1 file changed, 20 insertions(+)
src/apps/packageinstaller/PackageItem.cpp | 20 ++++++++++++++++++++

----------------------------------------------------------------------------

diff --git a/src/apps/packageinstaller/PackageItem.cpp 
b/src/apps/packageinstaller/PackageItem.cpp
index 2b5d53f..eda8368 100644
--- a/src/apps/packageinstaller/PackageItem.cpp
+++ b/src/apps/packageinstaller/PackageItem.cpp
@@ -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;
 }
 


Other related posts: