Changeset 71137 in vbox
- Timestamp:
- Feb 27, 2018 2:47:38 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/VideoRec.cpp
r70621 r71137 961 961 962 962 int rc; 963 if (p Stream->uScreenID> 1)963 if (pCfg->aScreens.size() > 1) 964 964 rc = RTStrAPrintf(&pszFile, "%s-%u%s", pszAbsPath, pStream->uScreenID + 1, pszSuff); 965 965 else … … 969 969 { 970 970 uint64_t fOpen = RTFILE_O_WRITE | RTFILE_O_DENY_WRITE; 971 #ifdef DEBUG 972 fOpen |= RTFILE_O_CREATE_REPLACE; 973 #else 971 974 972 /* Play safe: the file must not exist, overwriting is potentially 975 973 * hazardous as nothing prevents the user from picking a file name of some 976 974 * other important file, causing unintentional data loss. */ 977 975 fOpen |= RTFILE_O_CREATE; 978 #endif 976 979 977 RTFILE hFile; 980 978 rc = RTFileOpen(&hFile, pszFile, fOpen); 979 if (rc == VERR_ALREADY_EXISTS) 980 { 981 RTStrFree(pszFile); 982 pszFile = NULL; 983 984 RTTIMESPEC ts; 985 RTTimeNow(&ts); 986 RTTIME time; 987 RTTimeExplode(&time, &ts); 988 989 if (pCfg->aScreens.size() > 1) 990 rc = RTStrAPrintf(&pszFile, "%s-%04d-%02u-%02uT%02u-%02u-%02u-%09uZ-%u%s", 991 pszAbsPath, time.i32Year, time.u8Month, time.u8MonthDay, 992 time.u8Hour, time.u8Minute, time.u8Second, time.u32Nanosecond, 993 pStream->uScreenID + 1, pszSuff); 994 else 995 rc = RTStrAPrintf(&pszFile, "%s-%04d-%02u-%02uT%02u-%02u-%02u-%09uZ%s", 996 pszAbsPath, time.i32Year, time.u8Month, time.u8MonthDay, 997 time.u8Hour, time.u8Minute, time.u8Second, time.u32Nanosecond, 998 pszSuff); 999 1000 if (RT_SUCCESS(rc)) 1001 rc = RTFileOpen(&hFile, pszFile, fOpen); 1002 } 1003 981 1004 if (RT_SUCCESS(rc)) 982 1005 { … … 985 1008 pStream->File.pszFile = pszFile; /* Assign allocated string to our stream's config. */ 986 1009 } 987 else988 RTStrFree(pszFile);989 1010 } 990 1011 … … 993 1014 994 1015 if (RT_FAILURE(rc)) 995 LogRel(("VideoRec: Failed to open file for screen %RU32, rc=%Rrc\n", pStream->uScreenID, rc)); 1016 { 1017 LogRel(("VideoRec: Failed to open file '%s' for screen %RU32, rc=%Rrc\n", 1018 pszFile ? pszFile : "<Unnamed>", pStream->uScreenID, rc)); 1019 RTStrFree(pszFile); 1020 } 996 1021 997 1022 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.