VirtualBox

Changeset 33426 in vbox


Ignore:
Timestamp:
Oct 25, 2010 2:32:38 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
67016
Message:

iprt/symlink.h: Initial code (only tested on linux).

Location:
trunk
Files:
4 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/err.h

    r33386 r33426  
    430430#define VERR_NOT_IMPLEMENTED                (-12)
    431431
     432/** The specified path does not point at a symbolic link. */
     433#define VERR_NOT_SYMLINK                    (-19)
    432434/** Failed to allocate temporary memory. */
    433435#define VERR_NO_TMP_MEMORY                  (-20)
  • trunk/include/iprt/log.h

    r32355 r33426  
    5959    RTLOGGROUP_PATH,
    6060    RTLOGGROUP_PROCESS,
     61    RTLOGGROUP_SYMLINK,
    6162    RTLOGGROUP_THREAD,
    6263    RTLOGGROUP_TIME,
     
    8788    "RT_PATH",      \
    8889    "RT_PROCESS",   \
     90    "RT_SYMLINK",   \
    8991    "RT_THREAD",    \
    9092    "RT_TIME",      \
    9193    "RT_TIMER",     \
    92     "RT_10", \
    9394    "RT_11", \
    9495    "RT_12", \
  • trunk/src/VBox/Runtime/Makefile.kmk

    r33393 r33426  
    488488        r3/win/semeventmulti-win.cpp \
    489489        r3/win/semmutex-win.cpp \
     490        r3/win/symlink-win.cpp \
    490491        r3/win/rtFileNativeSetAttributes-win.cpp \
    491492        r3/win/thread-win.cpp \
     
    543544        r3/posix/rand-posix.cpp \
    544545        r3/posix/semrw-posix.cpp \
     546        r3/posix/symlink-posix.cpp \
    545547        r3/posix/thread-posix.cpp \
    546548        r3/posix/timelocal-posix.cpp \
     
    619621        r3/posix/pathhost-posix.cpp \
    620622        r3/posix/process-posix.cpp \
     623        r3/posix/symlink-posix.cpp \
    621624        r3/posix/timelocal-posix.cpp \
    622625        r3/posix/utf8-posix.cpp
     
    669672        r3/posix/semeventmulti-posix.cpp \
    670673        r3/posix/semmutex-posix.cpp \
     674        r3/posix/symlink-posix.cpp \
    671675        r3/posix/thread-posix.cpp \
    672676        r3/posix/timelocal-posix.cpp \
     
    726730        r3/posix/semmutex-posix.cpp \
    727731        r3/posix/semrw-posix.cpp \
     732        r3/posix/symlink-posix.cpp \
    728733        r3/posix/thread-posix.cpp \
    729734        r3/posix/time-posix.cpp \
     
    771776        r3/posix/semmutex-posix.cpp \
    772777        r3/posix/semrw-posix.cpp \
     778        r3/posix/symlink-posix.cpp \
    773779        r3/posix/thread-posix.cpp \
    774780        r3/posix/time-posix.cpp \
  • trunk/src/VBox/Runtime/generic/pathhost-generic.cpp

    r28919 r33426  
    8080}
    8181
     82
     83int rtPathFromNativeDup(char **ppszPath, const char *pszNativePath, const char *pszBasePath)
     84{
     85    int rc = RTStrValidateEncodingEx(pszNativePath, RTSTR_MAX, 0 /*fFlags*/);
     86    if (RT_SUCCESS(rc))
     87        rc = RTStrDupEx(ppszPath, pszNativePath);
     88    NOREF(pszBasePath); /* We don't query the FS for codeset preferences. */
     89    return rc;
     90}
     91
  • trunk/src/VBox/Runtime/include/internal/path.h

    r28915 r33426  
    8585 * @returns IPRT status code.
    8686 * @param   ppszPath        Where to store the pointer to the IPRT path.
    87  *                          Free by calling RTStrFree(). NULL on failure.
     87 *                          Free by calling rtPathFreeIprt(). NULL on failure.
    8888 * @param   pszNativePath   The native path to convert.
    8989 * @param   pszBasePath     What pszNativePath is relative to - in IPRT
     
    117117int rtPathFromNativeCopy(char *pszPath, size_t cbPath, const char *pszNativePath, const char *pszBasePath);
    118118
     119/**
     120 * Convert a path from the native representation to the IPRT one, allocating a
     121 * string buffer for the result.
     122 *
     123 * @returns VINF_SUCCESS, VERR_NO_STR_MEMORY, and recoding errors.
     124 *
     125 * @param   ppszPath        Where to return the pointer to the IPRT path.  Must
     126 *                          be freed by calling RTStrFree.
     127 * @param   pszNativePath   The path to convert.
     128 * @param   pszBasePath     What pszNativePath is relative to - in IPRT
     129 *                          representation.  NULL if current directory.
     130 */
     131int rtPathFromNativeDup(char **ppszPath, const char *pszNativePath, const char *pszBasePath);
     132
    119133
    120134RT_C_DECLS_END
  • trunk/src/VBox/Runtime/r3/darwin/pathhost-darwin.cpp

    r28919 r33426  
    9393}
    9494
     95
     96int rtPathFromNativeDup(char **ppszPath, const char *pszNativePath, const char *pszBasePath)
     97{
     98    /** @todo We must compose the codepoints in the string here.  We get file names
     99     *        in normalization form D so we'll end up with normalization form C
     100     *        whatever approach we take. */
     101    int rc = RTStrValidateEncodingEx(pszNativePath, RTSTR_MAX, 0 /*fFlags*/);
     102    if (RT_SUCCESS(rc))
     103        rc = RTStrDupEx(ppszPath, pszNativePath);
     104    NOREF(pszBasePath); /* We don't query the FS for codeset preferences. */
     105    return rc;
     106}
     107
  • trunk/src/VBox/Runtime/r3/posix/pathhost-posix.cpp

    r30303 r33426  
    263263}
    264264
     265
     266int rtPathFromNativeDup(char **ppszPath, const char *pszNativePath, const char *pszBasePath)
     267{
     268    int rc = RTOnce(&g_OnceInitPathConv, rtPathConvInitOnce, NULL, NULL);
     269    if (RT_SUCCESS(rc))
     270    {
     271        if (g_fPassthruUtf8 || !*pszNativePath)
     272            rc = RTStrDupEx(ppszPath, pszNativePath);
     273        else
     274            rc = rtStrConvert(pszNativePath, strlen(pszNativePath), g_szFsCodeset,
     275                              ppszPath, 0, "UTF-8",
     276                              2, g_enmFsToUtf8Idx);
     277    }
     278
     279    NOREF(pszBasePath); /* We don't query the FS for codeset preferences. */
     280    return rc;
     281}
     282
  • trunk/src/VBox/Runtime/testcase/Makefile.kmk

    r33290 r33426  
    100100        tstStrToNum \
    101101        tstRTStrVersion \
     102        tstRTSymlink \
    102103        tstRTSystemQueryDmi \
    103104        tstRTSystemQueryOsInfo \
     
    432433tstRTStrVersion_SOURCES = tstRTStrVersion.cpp
    433434
     435tstRTSymlink_TEMPLATE = VBOXR3TSTEXE
     436tstRTSymlink_SOURCES = tstRTSymlink.cpp
     437
    434438tstRTSystemQueryDmi_TEMPLATE = VBOXR3TSTEXE
    435439tstRTSystemQueryDmi_SOURCES = tstRTSystemQueryDmi.cpp
Note: See TracChangeset for help on using the changeset viewer.

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