Changeset 20018 in vbox for trunk/src/VBox/Runtime/r3
- Timestamp:
- May 26, 2009 9:37:49 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.