diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2021-04-16 10:21:26 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2021-04-19 23:12:55 -0500 |
| commit | 66360b60b0298c88d32ce2b5e5ce5befa1c09ff8 (patch) | |
| tree | a1006f5e72f350342af9a29cad081358e76f9025 /src | |
| parent | 5d6046bee5021052da4a666c1e2ceeb0f16af349 (diff) | |
| download | wix-66360b60b0298c88d32ce2b5e5ce5befa1c09ff8.tar.gz wix-66360b60b0298c88d32ce2b5e5ce5befa1c09ff8.tar.bz2 wix-66360b60b0298c88d32ce2b5e5ce5befa1c09ff8.zip | |
Only set the last used folder if the target passed verification.
Diffstat (limited to 'src')
| -rw-r--r-- | src/engine/apply.cpp | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/src/engine/apply.cpp b/src/engine/apply.cpp index dc9f905b..c39a7746 100644 --- a/src/engine/apply.cpp +++ b/src/engine/apply.cpp | |||
| @@ -26,6 +26,7 @@ typedef struct _BURN_CACHE_CONTEXT | |||
| 26 | LPWSTR* rgSearchPaths; | 26 | LPWSTR* rgSearchPaths; |
| 27 | DWORD cSearchPaths; | 27 | DWORD cSearchPaths; |
| 28 | DWORD cSearchPathsMax; | 28 | DWORD cSearchPathsMax; |
| 29 | LPWSTR sczLastUsedFolderCandidate; | ||
| 29 | } BURN_CACHE_CONTEXT; | 30 | } BURN_CACHE_CONTEXT; |
| 30 | 31 | ||
| 31 | typedef struct _BURN_CACHE_ACQUIRE_PROGRESS_CONTEXT | 32 | typedef struct _BURN_CACHE_ACQUIRE_PROGRESS_CONTEXT |
| @@ -563,6 +564,7 @@ LExit: | |||
| 563 | ReleaseNullStr(cacheContext.rgSearchPaths[i]); | 564 | ReleaseNullStr(cacheContext.rgSearchPaths[i]); |
| 564 | } | 565 | } |
| 565 | ReleaseMem(cacheContext.rgSearchPaths); | 566 | ReleaseMem(cacheContext.rgSearchPaths); |
| 567 | ReleaseStr(cacheContext.sczLastUsedFolderCandidate); | ||
| 566 | 568 | ||
| 567 | UserExperienceOnCacheComplete(pUX, hr); | 569 | UserExperienceOnCacheComplete(pUX, hr); |
| 568 | return hr; | 570 | return hr; |
| @@ -840,9 +842,17 @@ static HRESULT ApplyExtractContainer( | |||
| 840 | hr = ExtractContainer(pContext, pContainer); | 842 | hr = ExtractContainer(pContext, pContainer); |
| 841 | LogExitOnFailure(hr, MSG_FAILED_EXTRACT_CONTAINER, "Failed to extract payloads from container: %ls to working path: %ls", pContainer->sczId, pContainer->sczUnverifiedPath); | 843 | LogExitOnFailure(hr, MSG_FAILED_EXTRACT_CONTAINER, "Failed to extract payloads from container: %ls to working path: %ls", pContainer->sczId, pContainer->sczUnverifiedPath); |
| 842 | 844 | ||
| 845 | if (pContext->sczLastUsedFolderCandidate) | ||
| 846 | { | ||
| 847 | // We successfully copied from a source location, set that as the last used source. | ||
| 848 | CacheSetLastUsedSource(pContext->pVariables, pContext->sczLastUsedFolderCandidate, pContainer->sczFilePath); | ||
| 849 | } | ||
| 850 | |||
| 843 | pContext->qwSuccessfulCacheProgress += pContainer->qwFileSize; | 851 | pContext->qwSuccessfulCacheProgress += pContainer->qwFileSize; |
| 844 | 852 | ||
| 845 | LExit: | 853 | LExit: |
| 854 | ReleaseNullStr(pContext->sczLastUsedFolderCandidate); | ||
| 855 | |||
| 846 | return hr; | 856 | return hr; |
| 847 | } | 857 | } |
| 848 | 858 | ||
| @@ -901,6 +911,12 @@ static HRESULT ApplyLayoutContainer( | |||
| 901 | hr = LayoutOrCacheContainerOrPayload(pContext, pContainer, NULL, NULL, TRUE, cTryAgainAttempts, &fRetry); | 911 | hr = LayoutOrCacheContainerOrPayload(pContext, pContainer, NULL, NULL, TRUE, cTryAgainAttempts, &fRetry); |
| 902 | if (SUCCEEDED(hr)) | 912 | if (SUCCEEDED(hr)) |
| 903 | { | 913 | { |
| 914 | if (pContext->sczLastUsedFolderCandidate) | ||
| 915 | { | ||
| 916 | // We successfully copied from a source location, set that as the last used source. | ||
| 917 | CacheSetLastUsedSource(pContext->pVariables, pContext->sczLastUsedFolderCandidate, pContainer->sczFilePath); | ||
| 918 | } | ||
| 919 | |||
| 904 | pContext->qwSuccessfulCacheProgress += pContainer->qwFileSize; | 920 | pContext->qwSuccessfulCacheProgress += pContainer->qwFileSize; |
| 905 | break; | 921 | break; |
| 906 | } | 922 | } |
| @@ -915,11 +931,14 @@ static HRESULT ApplyLayoutContainer( | |||
| 915 | 931 | ||
| 916 | ++cTryAgainAttempts; | 932 | ++cTryAgainAttempts; |
| 917 | pContext->qwSuccessfulCacheProgress -= pContainer->qwFileSize; | 933 | pContext->qwSuccessfulCacheProgress -= pContainer->qwFileSize; |
| 934 | ReleaseNullStr(pContext->sczLastUsedFolderCandidate); | ||
| 918 | LogErrorId(hr, MSG_APPLY_RETRYING_PAYLOAD, pContainer->sczId, NULL, NULL); | 935 | LogErrorId(hr, MSG_APPLY_RETRYING_PAYLOAD, pContainer->sczId, NULL, NULL); |
| 919 | } | 936 | } |
| 920 | } | 937 | } |
| 921 | 938 | ||
| 922 | LExit: | 939 | LExit: |
| 940 | ReleaseNullStr(pContext->sczLastUsedFolderCandidate); | ||
| 941 | |||
| 923 | return hr; | 942 | return hr; |
| 924 | } | 943 | } |
| 925 | 944 | ||
| @@ -961,6 +980,12 @@ static HRESULT ApplyProcessPayload( | |||
| 961 | hr = LayoutOrCacheContainerOrPayload(pContext, NULL, pPackage, pPayload, FALSE, cTryAgainAttempts, &fRetry); | 980 | hr = LayoutOrCacheContainerOrPayload(pContext, NULL, pPackage, pPayload, FALSE, cTryAgainAttempts, &fRetry); |
| 962 | if (SUCCEEDED(hr)) | 981 | if (SUCCEEDED(hr)) |
| 963 | { | 982 | { |
| 983 | if (pContext->sczLastUsedFolderCandidate) | ||
| 984 | { | ||
| 985 | // We successfully copied from a source location, set that as the last used source. | ||
| 986 | CacheSetLastUsedSource(pContext->pVariables, pContext->sczLastUsedFolderCandidate, pPayload->sczFilePath); | ||
| 987 | } | ||
| 988 | |||
| 964 | pContext->qwSuccessfulCacheProgress += pPayload->qwFileSize; | 989 | pContext->qwSuccessfulCacheProgress += pPayload->qwFileSize; |
| 965 | break; | 990 | break; |
| 966 | } | 991 | } |
| @@ -975,11 +1000,14 @@ static HRESULT ApplyProcessPayload( | |||
| 975 | 1000 | ||
| 976 | ++cTryAgainAttempts; | 1001 | ++cTryAgainAttempts; |
| 977 | pContext->qwSuccessfulCacheProgress -= pPayload->qwFileSize; | 1002 | pContext->qwSuccessfulCacheProgress -= pPayload->qwFileSize; |
| 1003 | ReleaseNullStr(pContext->sczLastUsedFolderCandidate); | ||
| 978 | LogErrorId(hr, MSG_APPLY_RETRYING_PAYLOAD, pPayload->sczKey, NULL, NULL); | 1004 | LogErrorId(hr, MSG_APPLY_RETRYING_PAYLOAD, pPayload->sczKey, NULL, NULL); |
| 979 | } | 1005 | } |
| 980 | } | 1006 | } |
| 981 | 1007 | ||
| 982 | LExit: | 1008 | LExit: |
| 1009 | ReleaseNullStr(pContext->sczLastUsedFolderCandidate); | ||
| 1010 | |||
| 983 | return hr; | 1011 | return hr; |
| 984 | } | 1012 | } |
| 985 | 1013 | ||
| @@ -1245,12 +1273,9 @@ static HRESULT AcquireContainerOrPayload( | |||
| 1245 | hr = CopyPayload(&progress, INVALID_HANDLE_VALUE, pContext->rgSearchPaths[dwChosenSearchPath], wzDestinationPath); | 1273 | hr = CopyPayload(&progress, INVALID_HANDLE_VALUE, pContext->rgSearchPaths[dwChosenSearchPath], wzDestinationPath); |
| 1246 | // Error handling happens after sending complete message to BA. | 1274 | // Error handling happens after sending complete message to BA. |
| 1247 | 1275 | ||
| 1248 | // TODO: wait for verification? | 1276 | // Store the source path so it can be used as the LastUsedFolder if it passes verification. |
| 1249 | // We successfully copied from a source location, set that as the last used source. | 1277 | pContext->sczLastUsedFolderCandidate = pContext->rgSearchPaths[dwChosenSearchPath]; |
| 1250 | if (SUCCEEDED(hr)) | 1278 | pContext->rgSearchPaths[dwChosenSearchPath] = NULL; |
| 1251 | { | ||
| 1252 | CacheSetLastUsedSource(pContext->pVariables, pContext->rgSearchPaths[dwChosenSearchPath], wzRelativePath); | ||
| 1253 | } | ||
| 1254 | } | 1279 | } |
| 1255 | 1280 | ||
| 1256 | fBeginCalled = FALSE; | 1281 | fBeginCalled = FALSE; |
