Changeset 20018 in vbox
- Timestamp:
- May 26, 2009 9:37:49 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
include/iprt/path.h (modified) (1 diff)
-
src/VBox/Runtime/r3/path.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/path.h
r19928 r20018 455 455 456 456 /** 457 * Gets the temporary directory path. 458 * 459 * @returns iprt status code. 460 * @param pszPath Buffer where to store the path. 461 * @param cchPath Buffer size in bytes. 462 */ 463 RTDECL(int) RTPathTemp(char *pszPath, size_t cchPath); 464 465 /** 457 466 * Query information about a file system object. 458 467 * -
trunk/src/VBox/Runtime/r3/path.cpp
r19929 r20018 42 42 #include <iprt/err.h> 43 43 #include <iprt/uni.h> 44 #include <iprt/env.h> 44 45 #include "internal/fs.h" 45 46 #include "internal/path.h" … … 963 964 } 964 965 966 /** 967 * Gets the temporary directory path. 968 * 969 * @returns iprt status code. 970 * @param pszPath Buffer where to store the path. 971 * @param cchPath Buffer size in bytes. 972 */ 973 RTDECL(int) RTPathTemp(char *pszPath, size_t cchPath) 974 { 975 char *pszResult; 976 int rc; 977 const char *pszTmpEnv = RTEnvGet("TMP"); 978 if (!pszTmpEnv) 979 pszTmpEnv = RTEnvGet("TEMP"); 980 char *pszTmpDir; 981 /* Make a copy in any case. */ 982 if (pszTmpEnv) 983 pszTmpDir = RTStrDup(pszTmpEnv); 984 else 985 pszTmpDir = RTStrDup("/tmp"); 986 987 size_t cchTmpDir = strlen(pszTmpDir); 988 if (cchTmpDir < cchPath) 989 memcpy(pszPath, pszTmpDir, cchTmpDir + 1); 990 else 991 rc = VERR_BUFFER_OVERFLOW; 992 RTStrFree(pszTmpDir); 993 return rc; 994 } 995 965 996 #endif /* !RT_MINI */ 966 997
Note:
See TracChangeset
for help on using the changeset viewer.

