VirtualBox

Changeset 937 in vbox for trunk/src/VBox/Runtime/r3/win32


Ignore:
Timestamp:
Feb 15, 2007 8:59:20 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
18672
Message:

RTPathExists.

File:
1 edited

Legend:

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

    r1 r937  
    448448}
    449449
     450
     451/**
     452 * Checks if the path exists.
     453 *
     454 * Symbolic links will all be attempted resolved.
     455 *
     456 * @returns true if it exists and false if it doesn't
     457 * @param   pszPath     The path to check.
     458 */
     459RTDECL(bool) RTPathExists(const char *pszPath)
     460{
     461    /*
     462     * Validate input.
     463     */
     464    AssertPtrReturn(pszPath, false);
     465    AssertReturn(*pszPath, false);
     466
     467    /*
     468     * Try query file info.
     469     */
     470#ifndef RT_DONT_CONVERT_FILENAMES
     471    PRTUCS2 puszPath;
     472    int rc = RTStrUtf8ToUcs2(&puszPath, pszPath);
     473    if (RT_SUCCESS(rc))
     474    {
     475        if (GetFileAttributesW(puszPath) == INVALID_FILE_ATTRIBUTES)
     476            rc = VERR_GENERAL_FAILURE;
     477        RTStrUcs2Free(puszPath);
     478    }
     479#else
     480    int rc = VINF_SUCCESS;
     481    if (GetFileAttributesExA(pszPath) == INVALID_FILE_ATTRIBUTES)
     482        rc = VERR_GENERAL_FAILURE;
     483#endif
     484
     485    return RT_SUCCESS(rc);
     486}
     487
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