From 8a4d03207633e9fdc364aaed82bd167f844679f9 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Fri, 3 Jun 2022 17:47:31 -0500 Subject: 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. --- src/libs/dutil/WixToolset.DUtil/logutil.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/libs/dutil/WixToolset.DUtil/logutil.cpp') diff --git a/src/libs/dutil/WixToolset.DUtil/logutil.cpp b/src/libs/dutil/WixToolset.DUtil/logutil.cpp index bd21098c..94c21374 100644 --- a/src/libs/dutil/WixToolset.DUtil/logutil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/logutil.cpp @@ -117,6 +117,7 @@ extern "C" HRESULT DAPI LogOpen( { HRESULT hr = S_OK; BOOL fEnteredCriticalSection = FALSE; + LPWSTR sczCombined = NULL; LPWSTR sczLogDirectory = NULL; ::EnterCriticalSection(&LogUtil_csLog); @@ -129,9 +130,20 @@ extern "C" HRESULT DAPI LogOpen( } else { - hr = PathConcat(wzDirectory, wzLog, &LogUtil_sczLogPath); + hr = PathConcat(wzDirectory, wzLog, &sczCombined); LoguExitOnFailure(hr, "Failed to combine the log path."); + if (!PathIsFullyQualified(sczCombined, NULL)) + { + hr = PathExpand(&LogUtil_sczLogPath, sczCombined, PATH_EXPAND_FULLPATH); + LoguExitOnFailure(hr, "Failed to expand the log path."); + } + else + { + LogUtil_sczLogPath = sczCombined; + sczCombined = NULL; + } + hr = PathGetDirectory(LogUtil_sczLogPath, &sczLogDirectory); LoguExitOnFailure(hr, "Failed to get log directory."); @@ -176,6 +188,7 @@ LExit: ::LeaveCriticalSection(&LogUtil_csLog); } + ReleaseStr(sczCombined); ReleaseStr(sczLogDirectory); return hr; -- cgit v1.2.3-55-g6feb