Ticket #10164: PackageInstaller.2.patch

File PackageInstaller.2.patch, 1.7 KB (added by puckipedia, 10 years ago)

New version of the patch

  • src/apps/packageinstaller/PackageItem.cpp

    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  
    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    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
    207227    return ret;
    208228}
    209229