VirtualBox

Changeset 23302 in vbox


Ignore:
Timestamp:
Sep 24, 2009 5:00:38 PM (15 years ago)
Author:
vboxsync
Message:

IPRT: r52791 repated for RTFileExists.

Location:
trunk/src/VBox/Runtime
Files:
2 edited
1 copied

Legend:

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

    r23298 r23302  
    374374        generic/RTDirQueryInfo-generic.cpp \
    375375        generic/RTDirSetTimes-generic.cpp \
     376        generic/RTFileExists-generic.cpp \
    376377        generic/RTMpGetCurFrequency-generic.cpp \
    377378        generic/RTMpGetMaxFrequency-generic.cpp \
  • trunk/src/VBox/Runtime/generic/RTFileExists-generic.cpp

    r23299 r23302  
    11/* $Id$ */
    22/** @file
    3  * IPRT - RTDirExists, generic implementation.
     3 * IPRT - RTFileExists, generic implementation.
    44 */
    55
     
    3333*   Header Files                                                               *
    3434*******************************************************************************/
    35 #define LOG_GROUP RTLOGGROUP_DIR
     35#define LOG_GROUP RTLOGGROUP_FILE
    3636#include "internal/iprt.h"
    3737
    38 #include <iprt/dir.h>
     38#include <iprt/file.h>
    3939#include <iprt/err.h>
    4040#include <iprt/log.h>
     
    4242
    4343
    44 RTDECL(bool) RTDirExists(const char *pszPath)
     44RTDECL(bool) RTFileExists(const char *pszPath)
    4545{
    4646    RTFSOBJINFO ObjInfo;
    4747    int rc = RTPathQueryInfoEx(pszPath, &ObjInfo, RTFSOBJATTRADD_NOTHING, RTPATH_F_FOLLOW_LINK);
    4848    bool fRc = RT_SUCCESS(rc)
    49             && RTFS_IS_DIRECTORY(ObjInfo.Attr.fMode);
    50     LogFlow(("RTDirExists(%p:{%s}): returns %RTbool (%Rrc)\n", pszPath, pszPath, fRc, rc));
     49            && RTFS_IS_FILE(ObjInfo.Attr.fMode)
     50            && !(ObjInfo.Attr.fMode & (RTFS_DOS_NT_DEVICE | RTFS_DOS_NT_REPARSE_POINT)); /* paranoia */
     51    LogFlow(("RTFileExists(%p:{%s}): returns %RTbool (%Rrc)\n", pszPath, pszPath, fRc, rc));
    5152    return fRc;
    5253}
  • trunk/src/VBox/Runtime/r3/win/fileio-win.cpp

    r23047 r23302  
    126126
    127127    return fIsBeyondLimit;
    128 }
    129 
    130 
    131 RTDECL(bool) RTFileExists(const char *pszPath)
    132 {
    133     bool fRc = false;
    134 
    135     /*
    136      * Convert to UTF-16.
    137      */
    138     PRTUTF16 pwszString;
    139     int rc = RTStrToUtf16(pszPath, &pwszString);
    140     AssertRC(rc);
    141     if (RT_SUCCESS(rc))
    142     {
    143         /*
    144          * Query and check attributes.
    145          */
    146         DWORD dwAttr = GetFileAttributesW((LPCWSTR)pwszString);
    147         fRc = dwAttr != INVALID_FILE_ATTRIBUTES
    148             && !(dwAttr & (  FILE_ATTRIBUTE_DIRECTORY
    149                            | FILE_ATTRIBUTE_DEVICE
    150                            | FILE_ATTRIBUTE_REPARSE_POINT));
    151         RTUtf16Free(pwszString);
    152     }
    153 
    154     LogFlow(("RTFileExists(%p:{%s}): returns %RTbool\n", pszPath, pszPath, fRc));
    155     return fRc;
    156128}
    157129
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