Changeset 42748 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Aug 10, 2012 9:33:34 AM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 79963
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
r42391 r42748 5 5 6 6 /* 7 * Copyright (C) 2006-201 1Oracle Corporation7 * Copyright (C) 2006-2012 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 951 951 } 952 952 953 STDMETHODIMP SystemProperties::COMGETTER(DefaultAdditionsISO)(BSTR *aDefaultAdditionsISO) 954 { 955 CheckComArgOutPointerValid(aDefaultAdditionsISO); 956 957 AutoCaller autoCaller(this); 958 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 959 960 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 961 962 if (m->strDefaultAdditionsISO.isEmpty()) 963 { 964 /* no guest additions, check if it showed up in the mean time */ 965 alock.release(); 966 { 967 AutoWriteLock wlock(this COMMA_LOCKVAL_SRC_POS); 968 ErrorInfoKeeper eik; 969 (void)setDefaultAdditionsISO(""); 970 } 971 alock.acquire(); 972 } 973 m->strDefaultAdditionsISO.cloneTo(aDefaultAdditionsISO); 974 975 return S_OK; 976 } 977 978 STDMETHODIMP SystemProperties::COMSETTER(DefaultAdditionsISO)(IN_BSTR aDefaultAdditionsISO) 979 { 980 AutoCaller autoCaller(this); 981 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 982 983 /** @todo not yet implemented, settings handling is missing */ 984 ReturnComNotImplemented(); 985 986 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 987 HRESULT rc = setDefaultAdditionsISO(aDefaultAdditionsISO); 988 alock.release(); 989 990 if (SUCCEEDED(rc)) 991 { 992 // VirtualBox::saveSettings() needs vbox write lock 993 AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS); 994 rc = mParent->saveSettings(); 995 } 996 997 return rc; 998 } 999 953 1000 // public methods only for internal purposes 954 1001 ///////////////////////////////////////////////////////////////////////////// … … 982 1029 rc = setAutostartDatabasePath(data.strAutostartDatabasePath); 983 1030 if (FAILED(rc)) return rc; 1031 1032 { 1033 /* must ignore errors signalled here, because the guest additions 1034 * file may not exist, and in this case keep the empty string */ 1035 ErrorInfoKeeper eik; 1036 (void)setDefaultAdditionsISO(data.strDefaultAdditionsISO); 1037 } 984 1038 985 1039 return S_OK; … … 1190 1244 return rc; 1191 1245 } 1246 1247 HRESULT SystemProperties::setDefaultAdditionsISO(const Utf8Str &aPath) 1248 { 1249 Utf8Str path(aPath); 1250 if (path.isEmpty()) 1251 { 1252 char strTemp[RTPATH_MAX]; 1253 int vrc = RTPathAppPrivateNoArch(strTemp, sizeof(strTemp)); 1254 AssertRC(vrc); 1255 Utf8Str strSrc1 = Utf8Str(strTemp).append("/VBoxGuestAdditions.iso"); 1256 1257 vrc = RTPathExecDir(strTemp, sizeof(strTemp)); 1258 AssertRC(vrc); 1259 Utf8Str strSrc2 = Utf8Str(strTemp).append("/additions/VBoxGuestAdditions.iso"); 1260 1261 vrc = RTPathUserHome(strTemp, sizeof(strTemp)); 1262 AssertRC(vrc); 1263 Utf8Str strSrc3 = Utf8StrFmt("%s/VBoxGuestAdditions_%ls.iso", strTemp, VirtualBox::getVersionNormalized().raw()); 1264 1265 /* Check the standard image locations */ 1266 if (RTFileExists(strSrc1.c_str())) 1267 path = strSrc1; 1268 else if (RTFileExists(strSrc2.c_str())) 1269 path = strSrc2; 1270 else if (RTFileExists(strSrc3.c_str())) 1271 path = strSrc3; 1272 else 1273 return setError(E_FAIL, 1274 tr("Cannot determine default Guest Additions ISO location. Most likely they are not available")); 1275 } 1276 1277 if (!RTPathStartsWithRoot(path.c_str())) 1278 return setError(E_INVALIDARG, 1279 tr("Given default machine Guest Additions ISO file '%s' is not fully qualified"), 1280 path.c_str()); 1281 1282 if (!RTFileExists(path.c_str())) 1283 return setError(E_INVALIDARG, 1284 tr("Given default machine Guest Additions ISO file '%s' does not exist"), 1285 path.c_str()); 1286 1287 m->strDefaultAdditionsISO = path; 1288 1289 return S_OK; 1290 } -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r42569 r42748 40 40 #include <VBox/param.h> 41 41 #include <VBox/settings.h> 42 #include <VBox/version.h> 42 43 43 44 #include <package-generated.h> 44 #include <version-generated.h>45 45 46 46 #include <algorithm> … … 98 98 // static 99 99 Bstr VirtualBox::sVersion; 100 101 // static 102 Bstr VirtualBox::sVersionNormalized; 100 103 101 104 // static … … 371 374 if (sVersion.isEmpty()) 372 375 sVersion = RTBldCfgVersion(); 376 if (sVersionNormalized.isEmpty()) 377 { 378 Utf8Str tmp(RTBldCfgVersion()); 379 if (tmp.endsWith(VBOX_BUILD_PUBLISHER)) 380 tmp = tmp.substr(0, tmp.length() - strlen(VBOX_BUILD_PUBLISHER)); 381 sVersionNormalized = tmp; 382 } 373 383 sRevision = RTBldCfgRevision(); 374 384 if (sPackageType.isEmpty()) … … 857 867 858 868 sVersion.cloneTo(aVersion); 869 return S_OK; 870 } 871 872 STDMETHODIMP VirtualBox::COMGETTER(VersionNormalized)(BSTR *aVersionNormalized) 873 { 874 CheckComArgNotNull(aVersionNormalized); 875 876 AutoCaller autoCaller(this); 877 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 878 879 sVersionNormalized.cloneTo(aVersionNormalized); 859 880 return S_OK; 860 881 } … … 4466 4487 } 4467 4488 NOREF(rc); /* XXX */ 4489 } 4490 4491 4492 /* static */ 4493 const Bstr &VirtualBox::getVersionNormalized() 4494 { 4495 return sVersionNormalized; 4468 4496 } 4469 4497
Note:
See TracChangeset
for help on using the changeset viewer.