Changeset 49039 in vbox for trunk/src/VBox/Runtime/common/path
- Timestamp:
- Oct 10, 2013 6:27:32 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 89816
- Location:
- trunk/src/VBox/Runtime/common/path
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/path/RTPathExt.cpp
r48935 r49039 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 33 33 34 34 35 /** 36 * Finds the extension part of in a path. 37 * 38 * @returns Pointer to extension within pszPath. 39 * @returns NULL if no extension. 40 * @param pszPath Path to find extension in. 41 */ 42 RTDECL(char *) RTPathExt(const char *pszPath) 35 RTDECL(char *) RTPathSuffix(const char *pszPath) 43 36 { 44 37 const char *psz = pszPath; … … 66 59 /* the end */ 67 60 case '\0': 68 if (pszExt )61 if (pszExt && pszExt != pszPath && pszExt[1]) 69 62 return (char *)(void *)pszExt; 70 63 return NULL; -
trunk/src/VBox/Runtime/common/path/RTPathHasExt.cpp
r48935 r49039 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 34 34 35 35 36 /** 37 * Checks if a path has an extension. 38 * 39 * @returns true if extension present. 40 * @returns false if no extension present. 41 * @param pszPath Path to check. 42 */ 43 RTDECL(bool) RTPathHasExt(const char *pszPath) 36 RTDECL(bool) RTPathHasSuffix(const char *pszPath) 44 37 { 45 return RTPath Ext(pszPath) != NULL;38 return RTPathSuffix(pszPath) != NULL; 46 39 } 47 40 -
trunk/src/VBox/Runtime/common/path/RTPathStripExt.cpp
r48935 r49039 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 35 35 36 36 37 /** 38 * Strips the extension from a path. 39 * 40 * @param pszPath Path which extension should be stripped. 41 */ 42 RTDECL(void) RTPathStripExt(char *pszPath) 37 RTDECL(void) RTPathStripSuffix(char *pszPath) 43 38 { 44 char *pszDot = NULL; 45 for (;; pszPath++) 46 { 47 switch (*pszPath) 48 { 49 /* handle separators. */ 50 #if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2) 51 case ':': 52 case '\\': 53 #endif 54 case '/': 55 pszDot = NULL; 56 break; 57 case '.': 58 pszDot = pszPath; 59 break; 60 61 /* the end */ 62 case '\0': 63 if (pszDot) 64 *pszDot = '\0'; 65 return; 66 } 67 } 68 /* will never get here */ 39 char *pszSuffix = RTPathSuffix(pszPath); 40 if (pszSuffix) 41 *pszSuffix = '\0'; 69 42 } 70 43
Note:
See TracChangeset
for help on using the changeset viewer.