VirtualBox

Changeset 3861 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Jul 26, 2007 9:15:14 AM (18 years ago)
Author:
vboxsync
Message:

use generic functions for determining paths instead of home-brewn solutions

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r3833 r3861  
    46564656#ifdef VBOX_WITH_XPCOM
    46574657    // VBoxC is located in the components subdirectory
    4658     char szPathProgram[RTPATH_MAX + sizeof("/components/VBoxC")];
    4659     rc = RTPathProgram(szPathProgram, RTPATH_MAX);                                  AssertRC(rc);
    4660     strcat(szPathProgram, "/components/VBoxC");
    4661     rc = CFGMR3InsertString(pMod,   "Path",  szPathProgram);                           RC_CHECK();
     4658    char szPathVBoxC[RTPATH_MAX];
     4659    rc = RTPathAppPrivateArch(szPathVBoxC, RTPATH_MAX - sizeof("/components/VBoxC")); AssertRC(rc);
     4660    strcat(szPathVBoxC, "/components/VBoxC");
     4661    rc = CFGMR3InsertString(pMod,   "Path",  szPathVBoxC);                             RC_CHECK();
    46624662#else
    46634663    rc = CFGMR3InsertString(pMod,   "Path",  "VBoxC");                                 RC_CHECK();
  • trunk/src/VBox/Main/MachineImpl.cpp

    r3668 r3861  
    27882788    /* get the path to the executable */
    27892789    char path [RTPATH_MAX];
    2790     RTPathProgram (path, RTPATH_MAX);
     2790    RTPathAppPrivateArch (path, RTPATH_MAX);
    27912791    size_t sz = strlen (path);
    27922792    path [sz++] = RTPATH_DELIMITER;
  • trunk/src/VBox/Main/glue/initterm.cpp

    r3387 r3861  
    6464    DirectoryServiceProvider()
    6565        : mCompRegLocation (NULL), mXPTIDatLocation (NULL)
     66        , mComponentDirLocation (NULL), mCurrProcDirLocation (NULL)
    6667        {}
    6768
     
    6970
    7071    HRESULT init (const char *aCompRegLocation,
    71                   const char *aXPTIDatLocation);
     72                  const char *aXPTIDatLocation,
     73                  const char *aComponentDirLocation,
     74                  const char *aCurrProcDirLocation);
    7275
    7376    NS_DECL_NSIDIRECTORYSERVICEPROVIDER
     
    7780    char *mCompRegLocation;
    7881    char *mXPTIDatLocation;
     82    char *mComponentDirLocation;
     83    char *mCurrProcDirLocation;
    7984};
    8085
     
    9297        RTStrFree (mXPTIDatLocation);
    9398        mXPTIDatLocation = NULL;
     99    }
     100    if (mComponentDirLocation)
     101    {
     102        RTStrFree (mComponentDirLocation);
     103        mComponentDirLocation = NULL;
     104    }
     105    if (mCurrProcDirLocation)
     106    {
     107        RTStrFree (mCurrProcDirLocation);
     108        mCurrProcDirLocation = NULL;
    94109    }
    95110}
     
    101116HRESULT
    102117DirectoryServiceProvider::init (const char *aCompRegLocation,
    103                                 const char *aXPTIDatLocation)
     118                                const char *aXPTIDatLocation,
     119                                const char *aComponentDirLocation,
     120                                const char *aCurrProcDirLocation)
    104121{
    105122    AssertReturn (aCompRegLocation, NS_ERROR_INVALID_ARG);
     
    109126    if (RT_SUCCESS (vrc))
    110127        vrc = RTStrUtf8ToCurrentCP (&mXPTIDatLocation, aXPTIDatLocation);
     128    if (RT_SUCCESS (vrc) && aComponentDirLocation)
     129        vrc = RTStrUtf8ToCurrentCP (&mComponentDirLocation, aComponentDirLocation);
     130    if (RT_SUCCESS (vrc) && aCurrProcDirLocation)
     131        vrc = RTStrUtf8ToCurrentCP (&mCurrProcDirLocation, aCurrProcDirLocation);
    111132
    112133    return RT_SUCCESS (vrc) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
     
    130151    else if (strcmp (aProp, NS_XPCOM_XPTI_REGISTRY_FILE) == 0)
    131152        fileLocation = mXPTIDatLocation;
     153    else if (mComponentDirLocation && strcmp (aProp, NS_XPCOM_COMPONENT_DIR) == 0)
     154        fileLocation = mComponentDirLocation;
     155    else if (mCurrProcDirLocation && strcmp (aProp, NS_XPCOM_CURRENT_PROCESS_DIR) == 0)
     156        fileLocation = mCurrProcDirLocation;
    132157    else
    133158        return NS_ERROR_FAILURE;
     
    185210        /* prepare paths for registry files */
    186211        char homeDir [RTPATH_MAX];
     212        char privateArchDir [RTPATH_MAX];
    187213        int vrc = GetVBoxUserHomeDirectory (homeDir, sizeof (homeDir));
    188214        if (RT_SUCCESS (vrc))
     215            vrc = RTPathAppPrivateArch (privateArchDir, sizeof (privateArchDir));
     216        if (RT_SUCCESS (vrc))
    189217        {
    190218            char compReg [RTPATH_MAX];
    191219            char xptiDat [RTPATH_MAX];
     220            char compDir [RTPATH_MAX];
    192221
    193222            RTStrPrintf (compReg, sizeof (compReg), "%s%c%s",
     
    195224            RTStrPrintf (xptiDat, sizeof (xptiDat), "%s%c%s",
    196225                         homeDir, RTPATH_DELIMITER, "xpti.dat");
     226            RTStrPrintf (compDir, sizeof (compDir), "%s%c/components",
     227                         privateArchDir, RTPATH_DELIMITER);
    197228
    198229            dsProv = new DirectoryServiceProvider();
    199230            if (dsProv)
    200                 rc = dsProv->init (compReg, xptiDat);
     231                rc = dsProv->init (compReg, xptiDat, compDir, privateArchDir);
    201232            else
    202233                rc = NS_ERROR_OUT_OF_MEMORY;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette