Changeset 22516 in vbox
- Timestamp:
- Aug 27, 2009 12:42:16 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/file.h
r21801 r22516 54 54 55 55 #ifdef IN_RING3 56 57 /** 58 * Checks if the specified file name exists and is a regular file. 59 * 60 * Symbolic links will be resolved. 61 * 62 * @returns true if it's a regular file, false if it isn't. 63 * @param pszPath The path to the file. 64 * 65 * @sa RTDirExists, RTPathExists, RTSymlinkExists. 66 */ 67 RTDECL(bool) RTFileExists(const char *pszPath); 68 56 69 57 70 /** @name Open flags -
trunk/src/VBox/Runtime/r3/posix/fileio-posix.cpp
r21616 r22516 90 90 91 91 92 RTDECL(bool) RTFileExists(const char *pszPath) 93 { 94 bool fRc = false; 95 char *pszNativePath; 96 int rc = rtPathToNative(&pszNativePath, pszPath); 97 if (RT_SUCCESS(rc)) 98 { 99 struct stat s; 100 fRc = !stat(pszNativePath, &s) 101 && S_ISREG(s.st_mode); 102 103 rtPathFreeNative(pszNativePath); 104 } 105 106 LogFlow(("RTFileExists(%p={%s}): returns %RTbool\n", pszPath, pszPath, fRc)); 107 return fRc; 108 } 109 110 92 111 RTR3DECL(int) RTFileOpen(PRTFILE pFile, const char *pszFilename, unsigned fOpen) 93 112 { -
trunk/src/VBox/Runtime/r3/win/fileio-win.cpp
r21616 r22516 69 69 * @param uMethod Seek method. (The windows one!) 70 70 */ 71 inline boolMySetFilePointer(RTFILE File, uint64_t offSeek, uint64_t *poffNew, unsigned uMethod)71 DECLINLINE(bool) MySetFilePointer(RTFILE File, uint64_t offSeek, uint64_t *poffNew, unsigned uMethod) 72 72 { 73 73 bool fRc; … … 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_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; 128 156 } 129 157
Note:
See TracChangeset
for help on using the changeset viewer.