Skip to content

Commit

Permalink
Allow Log element to contain just a folder, in which case filename pr…
Browse files Browse the repository at this point in the history
…efix will take the executable's name
  • Loading branch information
nirbar committed Oct 29, 2023
1 parent 11d6b3a commit 1770ebc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/burn/engine/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ extern "C" HRESULT LoggingOpen(
LPWSTR sczLoggingBaseFolder = NULL;
LPWSTR sczPrefixFormatted = NULL;
LPCWSTR wzPostfix = NULL;
LPWSTR sczProcessPath = NULL;

switch (pInternalCommand->mode)
{
Expand Down Expand Up @@ -185,6 +186,15 @@ extern "C" HRESULT LoggingOpen(
hr = GetNonSessionSpecificTempFolder(&sczLoggingBaseFolder);
ExitOnFailure(hr, "Failed to get non-session specific TEMP folder.");
}

if (!wzPrefix || !*wzPrefix)
{
hr = PathForCurrentProcess(&sczProcessPath, NULL);
ExitOnFailure(hr, "Failed to get process full path.");

hr = FileStripExtension(sczProcessPath, &wzPrefix);
ExitOnFailure(hr, "Failed to get file name from path.");
}

hr = LogOpen(sczLoggingBaseFolder, wzPrefix, wzPostfix, pLog->sczExtension, FALSE, FALSE, &pLog->sczPath);
if (FAILED(hr))
Expand Down Expand Up @@ -233,6 +243,7 @@ extern "C" HRESULT LoggingOpen(

LExit:
ReleaseStr(sczLoggingBaseFolder);
ReleaseStr(sczProcessPath);
StrSecureZeroFreeString(sczPrefixFormatted);

return hr;
Expand Down

0 comments on commit 1770ebc

Please sign in to comment.