diff options
Diffstat (limited to 'src/burn/engine/cache.cpp')
-rw-r--r-- | src/burn/engine/cache.cpp | 46 |
1 files changed, 5 insertions, 41 deletions
diff --git a/src/burn/engine/cache.cpp b/src/burn/engine/cache.cpp index 251cd24b..c0ac3ecd 100644 --- a/src/burn/engine/cache.cpp +++ b/src/burn/engine/cache.cpp | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | #include "precomp.h" | 3 | #include "precomp.h" |
4 | 4 | ||
5 | static const LPCWSTR BUNDLE_CLEAN_ROOM_WORKING_FOLDER_NAME = L".cr"; | ||
6 | static const LPCWSTR BUNDLE_WORKING_FOLDER_NAME = L".be"; | 5 | static const LPCWSTR BUNDLE_WORKING_FOLDER_NAME = L".be"; |
7 | static const LPCWSTR UNVERIFIED_CACHE_FOLDER_NAME = L".unverified"; | 6 | static const LPCWSTR UNVERIFIED_CACHE_FOLDER_NAME = L".unverified"; |
8 | static const LPCWSTR PACKAGE_CACHE_FOLDER_NAME = L"Package Cache"; | 7 | static const LPCWSTR PACKAGE_CACHE_FOLDER_NAME = L"Package Cache"; |
@@ -242,8 +241,7 @@ LExit: | |||
242 | extern "C" HRESULT CacheInitializeSources( | 241 | extern "C" HRESULT CacheInitializeSources( |
243 | __in BURN_CACHE* pCache, | 242 | __in BURN_CACHE* pCache, |
244 | __in BURN_REGISTRATION* pRegistration, | 243 | __in BURN_REGISTRATION* pRegistration, |
245 | __in BURN_VARIABLES* pVariables, | 244 | __in BURN_VARIABLES* pVariables |
246 | __in BURN_ENGINE_COMMAND* pInternalCommand | ||
247 | ) | 245 | ) |
248 | { | 246 | { |
249 | Assert(!pCache->fInitializedCacheSources); | 247 | Assert(!pCache->fInitializedCacheSources); |
@@ -255,7 +253,6 @@ extern "C" HRESULT CacheInitializeSources( | |||
255 | LPWSTR sczOriginalSource = NULL; | 253 | LPWSTR sczOriginalSource = NULL; |
256 | LPWSTR sczOriginalSourceFolder = NULL; | 254 | LPWSTR sczOriginalSourceFolder = NULL; |
257 | BOOL fPathEqual = FALSE; | 255 | BOOL fPathEqual = FALSE; |
258 | LPCWSTR wzSourceProcessPath = pInternalCommand->sczSourceProcessPath; | ||
259 | 256 | ||
260 | hr = PathForCurrentProcess(&sczCurrentPath, NULL); | 257 | hr = PathForCurrentProcess(&sczCurrentPath, NULL); |
261 | ExitOnFailure(hr, "Failed to get current process path."); | 258 | ExitOnFailure(hr, "Failed to get current process path."); |
@@ -272,15 +269,7 @@ extern "C" HRESULT CacheInitializeSources( | |||
272 | 269 | ||
273 | pCache->fRunningFromCache = fPathEqual; | 270 | pCache->fRunningFromCache = fPathEqual; |
274 | 271 | ||
275 | // If a source process path was not provided (e.g. we are not being | 272 | hr = PathGetDirectory(sczCurrentPath, &pCache->sczSourceProcessFolder); |
276 | // run in a clean room) then use the current process path as the | ||
277 | // source process path. | ||
278 | if (!wzSourceProcessPath) | ||
279 | { | ||
280 | wzSourceProcessPath = sczCurrentPath; | ||
281 | } | ||
282 | |||
283 | hr = PathGetDirectory(wzSourceProcessPath, &pCache->sczSourceProcessFolder); | ||
284 | ExitOnFailure(hr, "Failed to initialize cache source folder."); | 273 | ExitOnFailure(hr, "Failed to initialize cache source folder."); |
285 | 274 | ||
286 | // If we're not running from the cache, ensure the original source is set. | 275 | // If we're not running from the cache, ensure the original source is set. |
@@ -288,15 +277,14 @@ extern "C" HRESULT CacheInitializeSources( | |||
288 | { | 277 | { |
289 | // If the original source has not been set already then set it where the bundle is | 278 | // If the original source has not been set already then set it where the bundle is |
290 | // running from right now. This value will be persisted and we'll use it when launched | 279 | // running from right now. This value will be persisted and we'll use it when launched |
291 | // from the clean room or package cache since none of our packages will be relative to | 280 | // from the package cache since none of our packages will be relative to those locations. |
292 | // those locations. | ||
293 | hr = VariableGetString(pVariables, BURN_BUNDLE_ORIGINAL_SOURCE, &sczOriginalSource); | 281 | hr = VariableGetString(pVariables, BURN_BUNDLE_ORIGINAL_SOURCE, &sczOriginalSource); |
294 | if (E_NOTFOUND == hr) | 282 | if (E_NOTFOUND == hr) |
295 | { | 283 | { |
296 | hr = VariableSetString(pVariables, BURN_BUNDLE_ORIGINAL_SOURCE, wzSourceProcessPath, FALSE, FALSE); | 284 | hr = VariableSetString(pVariables, BURN_BUNDLE_ORIGINAL_SOURCE, sczCurrentPath, FALSE, FALSE); |
297 | ExitOnFailure(hr, "Failed to set original source variable."); | 285 | ExitOnFailure(hr, "Failed to set original source variable."); |
298 | 286 | ||
299 | hr = StrAllocString(&sczOriginalSource, wzSourceProcessPath, 0); | 287 | hr = StrAllocString(&sczOriginalSource, sczCurrentPath, 0); |
300 | ExitOnFailure(hr, "Failed to copy current path to original source."); | 288 | ExitOnFailure(hr, "Failed to copy current path to original source."); |
301 | } | 289 | } |
302 | 290 | ||
@@ -899,30 +887,6 @@ extern "C" HRESULT CachePreparePackage( | |||
899 | return hr; | 887 | return hr; |
900 | } | 888 | } |
901 | 889 | ||
902 | extern "C" HRESULT CacheBundleToCleanRoom( | ||
903 | __in BURN_CACHE* pCache, | ||
904 | __in BURN_SECTION* pSection, | ||
905 | __deref_out_z_opt LPWSTR* psczCleanRoomBundlePath | ||
906 | ) | ||
907 | { | ||
908 | HRESULT hr = S_OK; | ||
909 | LPWSTR sczSourcePath = NULL; | ||
910 | LPWSTR wzExecutableName = NULL; | ||
911 | |||
912 | hr = PathForCurrentProcess(&sczSourcePath, NULL); | ||
913 | ExitOnFailure(hr, "Failed to get current path for process to cache to clean room."); | ||
914 | |||
915 | wzExecutableName = PathFile(sczSourcePath); | ||
916 | |||
917 | hr = CopyEngineToWorkingFolder(pCache, sczSourcePath, BUNDLE_CLEAN_ROOM_WORKING_FOLDER_NAME, wzExecutableName, pSection, psczCleanRoomBundlePath); | ||
918 | ExitOnFailure(hr, "Failed to cache bundle to clean room."); | ||
919 | |||
920 | LExit: | ||
921 | ReleaseStr(sczSourcePath); | ||
922 | |||
923 | return hr; | ||
924 | } | ||
925 | |||
926 | extern "C" HRESULT CacheBundleToWorkingDirectory( | 890 | extern "C" HRESULT CacheBundleToWorkingDirectory( |
927 | __in BURN_CACHE* pCache, | 891 | __in BURN_CACHE* pCache, |
928 | __in_z LPCWSTR wzExecutableName, | 892 | __in_z LPCWSTR wzExecutableName, |