Changeset 23302 in vbox
- Timestamp:
- Sep 24, 2009 5:00:38 PM (15 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 2 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/Makefile.kmk
r23298 r23302 374 374 generic/RTDirQueryInfo-generic.cpp \ 375 375 generic/RTDirSetTimes-generic.cpp \ 376 generic/RTFileExists-generic.cpp \ 376 377 generic/RTMpGetCurFrequency-generic.cpp \ 377 378 generic/RTMpGetMaxFrequency-generic.cpp \ -
trunk/src/VBox/Runtime/generic/RTFileExists-generic.cpp
r23299 r23302 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - RT DirExists, generic implementation.3 * IPRT - RTFileExists, generic implementation. 4 4 */ 5 5 … … 33 33 * Header Files * 34 34 *******************************************************************************/ 35 #define LOG_GROUP RTLOGGROUP_ DIR35 #define LOG_GROUP RTLOGGROUP_FILE 36 36 #include "internal/iprt.h" 37 37 38 #include <iprt/ dir.h>38 #include <iprt/file.h> 39 39 #include <iprt/err.h> 40 40 #include <iprt/log.h> … … 42 42 43 43 44 RTDECL(bool) RT DirExists(const char *pszPath)44 RTDECL(bool) RTFileExists(const char *pszPath) 45 45 { 46 46 RTFSOBJINFO ObjInfo; 47 47 int rc = RTPathQueryInfoEx(pszPath, &ObjInfo, RTFSOBJATTRADD_NOTHING, RTPATH_F_FOLLOW_LINK); 48 48 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)); 51 52 return fRc; 52 53 } -
trunk/src/VBox/Runtime/r3/win/fileio-win.cpp
r23047 r23302 126 126 127 127 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_ATTRIBUTES148 && !(dwAttr & ( FILE_ATTRIBUTE_DIRECTORY149 | FILE_ATTRIBUTE_DEVICE150 | FILE_ATTRIBUTE_REPARSE_POINT));151 RTUtf16Free(pwszString);152 }153 154 LogFlow(("RTFileExists(%p:{%s}): returns %RTbool\n", pszPath, pszPath, fRc));155 return fRc;156 128 } 157 129
Note:
See TracChangeset
for help on using the changeset viewer.