Changeset 40153 in vbox for trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
- Timestamp:
- Feb 16, 2012 2:56:18 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r39926 r40153 1319 1319 * If a non-null and non-empty base folder is specified, the default 1320 1320 * machine folder will be used as a base folder. 1321 * We sanitise the machine name to a safe white list of characters before 1322 * using it. 1321 1323 */ 1322 1324 Utf8Str strBase = aBaseFolder; 1325 Utf8Str strName = aName; 1326 /** Set of characters which should be safe for use in filenames: some basic 1327 * ASCII, Unicode from Latin-1 alphabetic to the end of Hangul. We try to 1328 * skip anything that could count as a control character in Windows or 1329 * *nix, or be otherwise difficult for shells to handle (I would have 1330 * preferred to remove the space and brackets too). We also remove all 1331 * characters which need UTF-16 surrogate pairs for Windows's benefit. */ 1332 RTUNICP aCpSet[] = 1333 { ' ', ' ', '(', ')', '-', '-', '0', '9', 'A', 'Z', 'a', 'z', '_', '_', 1334 0xa0, 0xd7af, '\0' }; 1335 Assert(RTStrPurgeComplementSet(strName.mutableRaw(), aCpSet, '_') > 0); 1323 1336 if (strBase.isEmpty()) 1324 1337 /* we use the non-full folder value below to keep the path relative */ … … 1327 1340 calculateFullPath(strBase, strBase); 1328 1341 1329 Bstr bstrSettingsFile = BstrFmt("%s%c% ls%c%ls.vbox",1342 Bstr bstrSettingsFile = BstrFmt("%s%c%s%c%s.vbox", 1330 1343 strBase.c_str(), 1331 1344 RTPATH_DELIMITER, 1332 aName,1345 strName.c_str(), 1333 1346 RTPATH_DELIMITER, 1334 aName); 1347 strName.c_str()); 1348 1349 #if 0 /* Try to get a unique name. */ 1350 for (unsigned i = 1; RTFileExists(bstrSettingsFile.c_str() && i < 100; ++i) 1351 bstrSettingsFile = BstrFmt("%s%c%s%u%c%s%u.vbox", 1352 strBase.c_str(), 1353 RTPATH_DELIMITER, 1354 strName.c_str(), i, 1355 RTPATH_DELIMITER, 1356 strName.c_str()); 1357 #endif 1335 1358 1336 1359 bstrSettingsFile.detachTo(aFilename);
Note:
See TracChangeset
for help on using the changeset viewer.