- Timestamp:
- Apr 4, 2024 3:49:03 PM (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/GuestSessionImplTasks.cpp
r104003 r104161 2973 2973 else 2974 2974 { 2975 if (RT_SUCCESS(vrc)) 2976 vrc = setProgress(5); 2977 2975 2978 Utf8Str strUpdateDir; 2976 2979 2977 vrc = setProgress(5); 2980 /* 2981 * Prepare the update directory. 2982 */ 2978 2983 if (RT_SUCCESS(vrc)) 2979 2984 { 2980 /* Try getting the installed Guest Additions version to know whether we 2981 * can install our temporary Guest Addition data into the original installation 2982 * directory. 2983 * 2984 * Because versions prior to 4.2 had bugs wrt spaces in paths we have to choose 2985 * a different location then. 2986 */ 2987 bool fUseInstallDir = false; 2988 2989 Utf8Str strAddsVer; 2990 vrc = getGuestProperty(pGuest, "/VirtualBox/GuestAdd/Version", strAddsVer); 2991 if ( RT_SUCCESS(vrc) 2992 && RTStrVersionCompare(strAddsVer.c_str(), "4.2r80329") > 0) 2993 { 2994 fUseInstallDir = true; 2995 } 2996 2997 if (fUseInstallDir) 2998 { 2999 vrc = getGuestProperty(pGuest, "/VirtualBox/GuestAdd/InstallDir", strUpdateDir); 3000 if (RT_SUCCESS(vrc)) 3001 { 3002 if (strUpdateDir.isNotEmpty()) 3003 { 3004 if (osType == eOSType_Windows) 3005 { 3006 strUpdateDir.findReplace('/', '\\'); 3007 strUpdateDir.append("\\Update\\"); 3008 } 3009 else 3010 strUpdateDir.append("/update/"); 3011 } 3012 /* else Older Guest Additions might not handle this property correctly. */ 3013 } 3014 /* Ditto. */ 3015 } 3016 3017 /** @todo Set fallback installation directory. Make this a *lot* smarter. Later. */ 3018 if (strUpdateDir.isEmpty()) 2985 /* Note: No fallback to unsafe guest locations! See @bugref{10625}. */ 2986 int vrcGuest; 2987 vrc = pSession->i_fsCreateTemp("VBoxAutoUpdate-XXXXXXXXXXXX", "" /* Use default temp dir */, 2988 true /* fDirectory */, strUpdateDir, 755 /* Mode */, false /* fSecure */, &vrcGuest); 2989 if (RT_SUCCESS(vrc)) 3019 2990 { 3020 2991 if (osType == eOSType_Windows) 3021 strUpdateDir = "C:\\Temp\\";2992 strUpdateDir.append("\\"); 3022 2993 else 3023 strUpdateDir = "/tmp/"; 2994 strUpdateDir.append("/"); 2995 2996 LogRel(("Guest Additions update directory is: %s\n", strUpdateDir.c_str())); 3024 2997 } 3025 } 3026 3027 /* Create the installation directory. */ 3028 int vrcGuest = VERR_IPE_UNINITIALIZED_STATUS; 3029 if (RT_SUCCESS(vrc)) 3030 { 3031 LogRel(("Guest Additions update directory is: %s\n", strUpdateDir.c_str())); 3032 3033 vrc = pSession->i_directoryCreate(strUpdateDir, 755 /* Mode */, DirectoryCreateFlag_Parents, &vrcGuest); 3034 if (RT_FAILURE(vrc)) 2998 else 3035 2999 { 3036 3000 switch (vrc) 3037 3001 { 3038 3002 case VERR_GSTCTL_GUEST_ERROR: 3039 hrc = setProgressErrorMsg(VBOX_E_IPRT_ERROR, tr("Creating installationdirectory on guest failed"),3003 hrc = setProgressErrorMsg(VBOX_E_IPRT_ERROR, tr("Creating update directory on guest failed"), 3040 3004 GuestErrorInfo(GuestErrorInfo::Type_Directory, vrcGuest, strUpdateDir.c_str())); 3041 3005 break; … … 3043 3007 default: 3044 3008 hrc = setProgressErrorMsg(VBOX_E_IPRT_ERROR, 3045 Utf8StrFmt(tr("Creating installationdirectory \"%s\" on guest failed: %Rrc"),3009 Utf8StrFmt(tr("Creating update directory \"%s\" on guest failed: %Rrc"), 3046 3010 strUpdateDir.c_str(), vrc)); 3047 3011 break;
Note:
See TracChangeset
for help on using the changeset viewer.