VirtualBox

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


Ignore:
Timestamp:
Apr 7, 2011 10:35:29 AM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
71059
Message:

iprt: add RTPathUserDocuments

Location:
trunk/src/VBox/Runtime
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/Makefile.kmk

    r36607 r36611  
    611611        r3/posix/path2-posix.cpp \
    612612        r3/posix/pathhost-posix.cpp \
     613        r3/posix/RTPathUserDocuments-posix.cpp \
    613614        r3/posix/pipe-posix.cpp \
    614615        r3/posix/poll-posix.cpp \
     
    699700        r3/posix/path2-posix.cpp \
    700701        r3/posix/pathhost-posix.cpp \
     702        r3/posix/RTPathUserDocuments-posix.cpp \
    701703        r3/posix/process-posix.cpp \
    702704        r3/posix/process-creation-posix.cpp \
     
    734736        r3/darwin/sched-darwin.cpp \
    735737        r3/darwin/time-darwin.cpp \
     738        r3/darwin/RTPathUserDocuments-darwin.cpp \
    736739        r3/posix/RTFileQueryFsSizes-posix.cpp \
    737740        r3/posix/RTHandleGetStandard-posix.cpp \
     
    809812        r3/posix/path2-posix.cpp \
    810813        r3/posix/pathhost-posix.cpp \
     814        r3/posix/RTPathUserDocuments-posix.cpp \
    811815        r3/posix/pipe-posix.cpp \
    812816        r3/posix/poll-posix.cpp \
     
    863867        r3/posix/path2-posix.cpp \
    864868        r3/posix/pathhost-posix.cpp \
     869        r3/posix/RTPathUserDocuments-posix.cpp \
    865870        r3/posix/pipe-posix.cpp \
    866871        r3/posix/poll-posix.cpp \
     
    951956        r3/posix/path-posix.cpp \
    952957        r3/posix/path2-posix.cpp \
     958        r3/posix/RTPathUserDocuments-posix.cpp \
    953959        r3/posix/rand-posix.cpp \
    954960        r3/posix/time-posix.cpp \
     
    12551261        $(PATH_SDK_$(VBOX_WINDDK)_LIB)/vccomsup.lib \
    12561262        $(PATH_SDK_$(VBOX_WINDDK)_LIB)/wbemuuid.lib
    1257 VBoxRT_LDFLAGS.darwin          = -framework IOKit -framework CoreFoundation -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxRT.dylib
     1263VBoxRT_LDFLAGS.darwin          = -framework IOKit -framework CoreFoundation -framework CoreServices -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxRT.dylib
    12581264ifdef VBOX_USE_VCC80
    12591265VBoxRT_LDFLAGS.win             = /MANIFEST
  • trunk/src/VBox/Runtime/r3/win/path-win.cpp

    r34003 r36611  
    179179     */
    180180    return RTUtf16ToUtf8Ex(&wszPath[0], RTSTR_MAX, &pszPath, cchPath, NULL);
     181}
     182
     183RTDECL(int) RTPathUserDocuments(char *pszPath, size_t cchPath)
     184{
     185    /*
     186     * Validate input
     187     */
     188    AssertPtrReturn(pszPath, VERR_INVALID_POINTER);
     189    AssertReturn(cchPath, VERR_INVALID_PARAMETER);
     190
     191    RTUTF16 wszPath[RTPATH_MAX];
     192    HRESULT rc = SHGetFolderPath(0, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, wszPath);
     193    if (   rc == S_OK     /* Found */
     194        || rc == S_FALSE) /* Found, but doesn't exists */
     195        /*
     196         * Convert and return.
     197         */
     198        return RTUtf16ToUtf8Ex(&wszPath[0], RTSTR_MAX, &pszPath, cchPath, NULL);
     199
     200    return VERR_PATH_NOT_FOUND;
    181201}
    182202
  • trunk/src/VBox/Runtime/testcase/tstRTPath.cpp

    r33806 r36611  
    7070    if (RT_SUCCESS(rc))
    7171        RTTestIPrintf(RTTESTLVL_INFO, "UserHome={%s}\n", szPath);
     72
     73    RTTestSub(hTest, "RTPathUserDocuments");
     74    RTTESTI_CHECK_RC(RTPathUserDocuments(szPath, sizeof(szPath)), VINF_SUCCESS);
     75    if (RT_SUCCESS(rc))
     76        RTTestIPrintf(RTTESTLVL_INFO, "UserDocuments={%s}\n", szPath);
    7277
    7378    RTTestSub(hTest, "RTPathTemp");
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