VirtualBox

Changeset 35218 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Dec 17, 2010 12:45:16 PM (14 years ago)
Author:
vboxsync
Message:

Introduced RTPathAppPrivateArchTop for hacking around the /opt/VirtualBox/amd64 and /opt/VirtualBox/i386 issues with RTPathAppPrivateArch. Changed RTPathAppDocs to returned the same directory name.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/path.cpp

    r33454 r35218  
    3939
    4040
     41#ifdef RT_OS_SOLARIS
     42/**
     43 * Hack to strip of the architecture subdirectory from the exec dir.
     44 *
     45 * @returns See RTPathExecDir.
     46 * @param   pszPath             See RTPathExecDir.
     47 * @param   cchPath             See RTPathExecDir.
     48 */
     49static int rtPathSolarisArchHack(char *pszPath, size_t cchPath)
     50{
     51    int rc = RTPathExecDir(pszPath, cchPath);
     52    if (RT_SUCCESS(rc))
     53    {
     54        const char *pszLast = RTPathFilename(pszPath);
     55        if (   !strcmp(pszLast, "amd64")
     56            || !strcmp(pszLast, "i386"))
     57            RTPathStripFilename(pszPath);
     58    }
     59    return rc;
     60}
     61#endif
     62
     63
    4164RTDECL(int) RTPathExecDir(char *pszPath, size_t cchPath)
    4265{
     
    5982
    6083
    61 /**
    62  * Gets the directory for architecture-independent application data, for
    63  * example NLS files, module sources, ...
    64  *
    65  * Linux:    /usr/shared/@<application@>
    66  * Windows:  @<program files directory@>/@<application@>
    67  * Old path: same as RTPathExecDir()
    68  *
    69  */
    7084RTDECL(int) RTPathAppPrivateNoArch(char *pszPath, size_t cchPath)
    7185{
    7286#if !defined(RT_OS_WINDOWS) && defined(RTPATH_APP_PRIVATE)
    7387    return RTStrCopy(pszPath, cchPath, RTPATH_APP_PRIVATE);
     88#elif defined(RT_OS_SOLARIS) && 0 /// @todo fix this
     89    return rtPathSolarisArchHack(pszPath, cchPath);
    7490#else
    7591    return RTPathExecDir(pszPath, cchPath);
     
    7894
    7995
    80 /**
    81  * Gets the directory for architecture-dependent application data, for
    82  * example modules which can be loaded at runtime.
    83  *
    84  * Linux:    /usr/lib/@<application@>
    85  * Windows:  @<program files directory@>/@<application@>
    86  * Old path: same as RTPathExecDir()
    87  *
    88  * @returns iprt status code.
    89  * @param   pszPath     Buffer where to store the path.
    90  * @param   cchPath     Buffer size in bytes.
    91  */
    9296RTDECL(int) RTPathAppPrivateArch(char *pszPath, size_t cchPath)
    9397{
     
    100104
    101105
    102 /**
    103  * Gets the directory of shared libraries. This is not the same as
    104  * RTPathAppPrivateArch() as Linux depends all shared libraries in
    105  * a common global directory where ld.so can found them.
    106  *
    107  * Linux:    /usr/lib
    108  * Windows:  @<program files directory@>/@<application@>
    109  * Old path: same as RTPathExecDir()
    110  *
    111  * @returns iprt status code.
    112  * @param   pszPath     Buffer where to store the path.
    113  * @param   cchPath     Buffer size in bytes.
    114  */
     106RTDECL(int) RTPathAppPrivateArchTop(char *pszPath, size_t cchPath)
     107{
     108#if !defined(RT_OS_WINDOWS) && defined(RTPATH_APP_PRIVATE_ARCH)
     109    return RTStrCopy(pszPath, cchPath, RTPATH_APP_PRIVATE_ARCH);
     110#elif defined(RT_OS_SOLARIS)
     111    return rtPathSolarisArchHack(pszPath, cchPath);
     112#else
     113    return RTPathExecDir(pszPath, cchPath);
     114#endif
     115}
     116
     117
    115118RTDECL(int) RTPathSharedLibs(char *pszPath, size_t cchPath)
    116119{
     
    123126
    124127
    125 /**
    126  * Gets the directory for documentation.
    127  *
    128  * Linux:    /usr/share/doc/@<application@>
    129  * Windows:  @<program files directory@>/@<application@>
    130  * Old path: same as RTPathExecDir()
    131  *
    132  * @returns iprt status code.
    133  * @param   pszPath     Buffer where to store the path.
    134  * @param   cchPath     Buffer size in bytes.
    135  */
    136128RTDECL(int) RTPathAppDocs(char *pszPath, size_t cchPath)
    137129{
    138130#if !defined(RT_OS_WINDOWS) && defined(RTPATH_APP_DOCS)
    139131    return RTStrCopy(pszPath, cchPath, RTPATH_APP_DOCS);
     132#elif defined(RT_OS_SOLARIS)
     133    return rtPathSolarisArchHack(pszPath, cchPath);
    140134#else
    141135    return RTPathExecDir(pszPath, cchPath);
     
    144138
    145139
    146 /**
    147  * Gets the temporary directory path.
    148  *
    149  * @returns iprt status code.
    150  *
    151  * @param   pszPath     Buffer where to store the path.
    152  * @param   cchPath     Buffer size in bytes.
    153  */
    154140RTDECL(int) RTPathTemp(char *pszPath, size_t cchPath)
    155141{
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