VirtualBox

Ignore:
Timestamp:
Apr 7, 2011 10:35:29 AM (14 years ago)
Author:
vboxsync
Message:

iprt: add RTPathUserDocuments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
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