From: <sv...@op...> - 2025-01-04 16:11:58
|
Author: sagamusix Date: Sat Jan 4 17:11:46 2025 New Revision: 22805 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22805 Log: [Fix] Passing a relative path as command-line argument was broken again since r14621, and probably never worked correctly when such a path was passed to another OpenMPT instance. Modified: trunk/OpenMPT/mptrack/Mptrack.cpp Modified: trunk/OpenMPT/mptrack/Mptrack.cpp ============================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp Sat Jan 4 17:11:20 2025 (r22804) +++ trunk/OpenMPT/mptrack/Mptrack.cpp Sat Jan 4 17:11:46 2025 (r22805) @@ -329,6 +329,13 @@ #endif public: + CMPTCommandLineInfo() + { + std::vector<TCHAR> curDir(::GetCurrentDirectory(0, nullptr), _T('\0')); + ::GetCurrentDirectory(static_cast<DWORD>(curDir.size()), curDir.data()); + m_workingDir = mpt::PathString::FromNative(curDir.data()); + } + void ParseParam(LPCTSTR param, BOOL isFlag, BOOL isLast) override { if(isFlag) @@ -350,11 +357,14 @@ #endif } else { - m_fileNames.push_back(mpt::PathString::FromNative(param)); + m_fileNames.push_back(mpt::RelativePathToAbsolute(mpt::PathString::FromNative(param), m_workingDir)); if(m_nShellCommand == FileNew) m_nShellCommand = FileOpen; } CCommandLineInfo::ParseParam(param, isFlag, isLast); } + +protected: + mpt::PathString m_workingDir; }; @@ -1088,7 +1098,7 @@ return true; } -static bool SystemCanRunCurrentBuild() +static bool SystemCanRunCurrentBuild() { if(mpt::OS::Windows::IsOriginal()) { |