Ticket #10164: PackageInstaller.patch

File PackageInstaller.patch, 1.5 KB (added by puckipedia, 10 years ago)
  • src/apps/packageinstaller/PackageItem.cpp

    From 0cbc7e3f8f95b958304b0a86c9b9a1f7d1e4ec86 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 | 17 +++++++++++++++++
     1 file changed, 17 insertions(+)
    
    diff --git a/src/apps/packageinstaller/PackageItem.cpp b/src/apps/packageinstaller/PackageItem.cpp
    index 2b5d53f..6959eb9 100644
    a b  
    1515#include <ByteOrder.h>
    1616#include <Catalog.h>
    1717#include <Directory.h>
     18#include <FindDirectory.h>
    1819#include <fs_info.h>
    1920#include <Locale.h>
    2021#include <NodeInfo.h>
    PackageItem::InitPath(const char *path, BPath *destination)  
    204205        ret = destination->SetTo(mountPoint.Path(), fPath.String());
    205206    }
    206207
     208    BPath systemNonPackagedDir;
     209    find_directory(B_SYSTEM_NONPACKAGED_DIRECTORY, &systemNonPackagedDir);
     210
     211    BString pathString(destination->Path());
     212
     213    // Hardcoded paths, the .pkg files hardcode this to the same
     214    if (pathString.FindFirst("/boot/system") == 0 && pathString.FindFirst("non-packaged") == B_ERROR) {
     215        pathString.Replace("/boot/system", systemNonPackagedDir.Path(), 1);
     216    }
     217
     218    if (pathString.FindFirst("/config") == 0 && pathString.FindFirst("non-packaged") == B_ERROR) {
     219        pathString.Replace("/config", "/config/non-packaged", 1);
     220    }
     221
     222    destination->SetTo(pathString.String());
     223
    207224    return ret;
    208225}
    209226