diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2022-01-14 21:37:24 -0600 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2022-01-16 10:30:28 -0600 |
| commit | da1d1376953ef1c9afb32d5eee02b785e52e372e (patch) | |
| tree | 0df8550960259d7b13f5cd90f04d21b5576f16b7 /src/burn/engine/logging.cpp | |
| parent | abe316b80fae80eba54b0b79e76b6362105fa098 (diff) | |
| download | wix-da1d1376953ef1c9afb32d5eee02b785e52e372e.tar.gz wix-da1d1376953ef1c9afb32d5eee02b785e52e372e.tar.bz2 wix-da1d1376953ef1c9afb32d5eee02b785e52e372e.zip | |
Remove orphan compatible MSI packages.
Reimplements #3190
Diffstat (limited to 'src/burn/engine/logging.cpp')
| -rw-r--r-- | src/burn/engine/logging.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/burn/engine/logging.cpp b/src/burn/engine/logging.cpp index 1e436f68..7c048523 100644 --- a/src/burn/engine/logging.cpp +++ b/src/burn/engine/logging.cpp | |||
| @@ -227,6 +227,49 @@ extern "C" void LoggingIncrementPackageSequence() | |||
| 227 | ++vdwPackageSequence; | 227 | ++vdwPackageSequence; |
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | extern "C" HRESULT LoggingSetCompatiblePackageVariable( | ||
| 231 | __in BURN_PACKAGE* pPackage, | ||
| 232 | __in BURN_LOGGING* pLog, | ||
| 233 | __in BURN_VARIABLES* pVariables, | ||
| 234 | __out_opt LPWSTR* psczLogPath | ||
| 235 | ) | ||
| 236 | { | ||
| 237 | HRESULT hr = S_OK; | ||
| 238 | LPWSTR sczLogPathVariable = NULL; | ||
| 239 | LPWSTR sczLogPath = NULL; | ||
| 240 | |||
| 241 | // Make sure that no package log files are created when logging has been disabled via Log element. | ||
| 242 | if (BURN_LOGGING_STATE_DISABLED == pLog->state) | ||
| 243 | { | ||
| 244 | ExitFunction(); | ||
| 245 | } | ||
| 246 | |||
| 247 | if (pPackage->sczLogPathVariable && *pPackage->sczLogPathVariable) | ||
| 248 | { | ||
| 249 | // Format a suitable log path variable from the original package. | ||
| 250 | hr = StrAllocFormatted(&sczLogPathVariable, L"%ls_Compatible", pPackage->sczLogPathVariable); | ||
| 251 | ExitOnFailure(hr, "Failed to format log path variable for compatible package."); | ||
| 252 | |||
| 253 | hr = StrAllocFormatted(&sczLogPath, L"%ls_%03u_%ls_%ls.%ls", pLog->sczPrefix, vdwPackageSequence, pPackage->sczId, pPackage->compatiblePackage.compatibleEntry.sczId, pLog->sczExtension); | ||
| 254 | ExitOnFailure(hr, "Failed to allocate path for package log."); | ||
| 255 | |||
| 256 | hr = VariableSetString(pVariables, sczLogPathVariable, sczLogPath, FALSE, FALSE); | ||
| 257 | ExitOnFailure(hr, "Failed to set log path into variable."); | ||
| 258 | |||
| 259 | if (psczLogPath) | ||
| 260 | { | ||
| 261 | hr = StrAllocString(psczLogPath, sczLogPath, 0); | ||
| 262 | ExitOnFailure(hr, "Failed to copy package log path."); | ||
| 263 | } | ||
| 264 | } | ||
| 265 | |||
| 266 | LExit: | ||
| 267 | ReleaseStr(sczLogPathVariable); | ||
| 268 | ReleaseStr(sczLogPath); | ||
| 269 | |||
| 270 | return hr; | ||
| 271 | } | ||
| 272 | |||
| 230 | extern "C" HRESULT LoggingSetPackageVariable( | 273 | extern "C" HRESULT LoggingSetPackageVariable( |
| 231 | __in BURN_PACKAGE* pPackage, | 274 | __in BURN_PACKAGE* pPackage, |
| 232 | __in_z_opt LPCWSTR wzSuffix, | 275 | __in_z_opt LPCWSTR wzSuffix, |
