diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-06-03 17:47:31 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-06-07 19:44:36 -0500 |
commit | 8a4d03207633e9fdc364aaed82bd167f844679f9 (patch) | |
tree | 9ca862bb51fd3507fc5867c292aef236e3411867 /src/burn | |
parent | 5d35ff01e33b8ffdab04a49ddc5927185309391a (diff) | |
download | wix-8a4d03207633e9fdc364aaed82bd167f844679f9.tar.gz wix-8a4d03207633e9fdc364aaed82bd167f844679f9.tar.bz2 wix-8a4d03207633e9fdc364aaed82bd167f844679f9.zip |
Resolve paths while parsing them from the command line.
The current directory is a process wide setting that can potentially be changed by any thread.
Remove fileutil methods that had equivalent pathutil methods.
Diffstat (limited to 'src/burn')
-rw-r--r-- | src/burn/engine/core.cpp | 18 | ||||
-rw-r--r-- | src/burn/engine/logging.cpp | 5 |
2 files changed, 7 insertions, 16 deletions
diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp index 4255fa6b..39836bce 100644 --- a/src/burn/engine/core.cpp +++ b/src/burn/engine/core.cpp | |||
@@ -1419,7 +1419,7 @@ extern "C" HRESULT CoreParseCommandLine( | |||
1419 | 1419 | ||
1420 | ++i; | 1420 | ++i; |
1421 | 1421 | ||
1422 | hr = StrAllocString(&pInternalCommand->sczLogFile, argv[i], 0); | 1422 | hr = PathExpand(&pInternalCommand->sczLogFile, argv[i], PATH_EXPAND_FULLPATH); |
1423 | ExitOnFailure(hr, "Failed to copy log file path."); | 1423 | ExitOnFailure(hr, "Failed to copy log file path."); |
1424 | } | 1424 | } |
1425 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], -1, L"?", -1) || | 1425 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], -1, L"?", -1) || |
@@ -1516,7 +1516,7 @@ extern "C" HRESULT CoreParseCommandLine( | |||
1516 | } | 1516 | } |
1517 | 1517 | ||
1518 | ++i; | 1518 | ++i; |
1519 | hr = StrAllocString(&pInternalCommand->sczOriginalSource, argv[i], 0); | 1519 | hr = PathExpand(&pInternalCommand->sczOriginalSource, argv[i], PATH_EXPAND_FULLPATH); |
1520 | ExitOnFailure(hr, "Failed to copy last used source."); | 1520 | ExitOnFailure(hr, "Failed to copy last used source."); |
1521 | } | 1521 | } |
1522 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], -1, BURN_COMMANDLINE_SWITCH_PARENT, -1)) | 1522 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], -1, BURN_COMMANDLINE_SWITCH_PARENT, -1)) |
@@ -1547,7 +1547,7 @@ extern "C" HRESULT CoreParseCommandLine( | |||
1547 | 1547 | ||
1548 | ++i; | 1548 | ++i; |
1549 | 1549 | ||
1550 | hr = StrAllocString(&pInternalCommand->sczLogFile, argv[i], 0); | 1550 | hr = PathExpand(&pInternalCommand->sczLogFile, argv[i], PATH_EXPAND_FULLPATH); |
1551 | ExitOnFailure(hr, "Failed to copy append log file path."); | 1551 | ExitOnFailure(hr, "Failed to copy append log file path."); |
1552 | 1552 | ||
1553 | pInternalCommand->dwLoggingAttributes |= BURN_LOGGING_ATTRIBUTE_APPEND; | 1553 | pInternalCommand->dwLoggingAttributes |= BURN_LOGGING_ATTRIBUTE_APPEND; |
@@ -1638,7 +1638,7 @@ extern "C" HRESULT CoreParseCommandLine( | |||
1638 | } | 1638 | } |
1639 | else if (L'\0' != wzParam[1]) | 1639 | else if (L'\0' != wzParam[1]) |
1640 | { | 1640 | { |
1641 | hr = StrAllocString(&pInternalCommand->sczSourceProcessPath, wzParam + 1, 0); | 1641 | hr = PathExpand(&pInternalCommand->sczSourceProcessPath, wzParam + 1, PATH_EXPAND_FULLPATH); |
1642 | ExitOnFailure(hr, "Failed to copy source process path."); | 1642 | ExitOnFailure(hr, "Failed to copy source process path."); |
1643 | } | 1643 | } |
1644 | } | 1644 | } |
@@ -1807,16 +1807,10 @@ extern "C" HRESULT CoreParseCommandLine( | |||
1807 | fInvalidCommandLine = TRUE; | 1807 | fInvalidCommandLine = TRUE; |
1808 | TraceLog(E_INVALIDARG, "Invalid switch: %ls", argv[i]); | 1808 | TraceLog(E_INVALIDARG, "Invalid switch: %ls", argv[i]); |
1809 | } | 1809 | } |
1810 | else if (L'\0' == wzParam[1]) | ||
1811 | { | ||
1812 | // Need to grab the current directory here since this is passed on to other processes. | ||
1813 | hr = DirGetCurrent(&pInternalCommand->sczEngineWorkingDirectory); | ||
1814 | ExitOnFailure(hr, "Failed to get current directory for custom working directory."); | ||
1815 | } | ||
1816 | else | 1810 | else |
1817 | { | 1811 | { |
1818 | hr = StrAllocString(&pInternalCommand->sczEngineWorkingDirectory, wzParam + 1, 0); | 1812 | hr = PathExpand(&pInternalCommand->sczEngineWorkingDirectory, wzParam + 1, PATH_EXPAND_FULLPATH); |
1819 | ExitOnFailure(hr, "Failed to allocate the custom working directory."); | 1813 | ExitOnFailure(hr, "Failed to store the custom working directory."); |
1820 | } | 1814 | } |
1821 | } | 1815 | } |
1822 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], lstrlenW(BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED), BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED, lstrlenW(BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED))) | 1816 | else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], lstrlenW(BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED), BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED, lstrlenW(BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED))) |
diff --git a/src/burn/engine/logging.cpp b/src/burn/engine/logging.cpp index 8e89957b..3a403025 100644 --- a/src/burn/engine/logging.cpp +++ b/src/burn/engine/logging.cpp | |||
@@ -84,9 +84,6 @@ extern "C" HRESULT LoggingOpen( | |||
84 | { | 84 | { |
85 | DWORD cRetry = 0; | 85 | DWORD cRetry = 0; |
86 | 86 | ||
87 | hr = DirGetCurrent(&sczLoggingBaseFolder); | ||
88 | ExitOnFailure(hr, "Failed to get current directory."); | ||
89 | |||
90 | // Try pretty hard to open the log file when appending. | 87 | // Try pretty hard to open the log file when appending. |
91 | do | 88 | do |
92 | { | 89 | { |
@@ -95,7 +92,7 @@ extern "C" HRESULT LoggingOpen( | |||
95 | ::Sleep(LOG_OPEN_RETRY_WAIT); | 92 | ::Sleep(LOG_OPEN_RETRY_WAIT); |
96 | } | 93 | } |
97 | 94 | ||
98 | hr = LogOpen(sczLoggingBaseFolder, pLog->sczPath, NULL, NULL, pLog->dwAttributes & BURN_LOGGING_ATTRIBUTE_APPEND, FALSE, &pLog->sczPath); | 95 | hr = LogOpen(NULL, pLog->sczPath, NULL, NULL, pLog->dwAttributes & BURN_LOGGING_ATTRIBUTE_APPEND, FALSE, &pLog->sczPath); |
99 | if (pLog->dwAttributes & BURN_LOGGING_ATTRIBUTE_APPEND && HRESULT_FROM_WIN32(ERROR_SHARING_VIOLATION) == hr) | 96 | if (pLog->dwAttributes & BURN_LOGGING_ATTRIBUTE_APPEND && HRESULT_FROM_WIN32(ERROR_SHARING_VIOLATION) == hr) |
100 | { | 97 | { |
101 | ++cRetry; | 98 | ++cRetry; |