Skip to content

Commit

Permalink
[Fix] Passing a relative path as command-line argument was broken aga…
Browse files Browse the repository at this point in the history
…in since r14621, and probably never worked correctly when such a path was passed to another OpenMPT instance.

git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@22805 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
sagamusix committed Jan 4, 2025
1 parent def8a7f commit 63e38ae
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions mptrack/Mptrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,13 @@ class CMPTCommandLineInfo: public CCommandLineInfo
#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)
Expand All @@ -350,11 +357,14 @@ class CMPTCommandLineInfo: public CCommandLineInfo
#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;
};


Expand Down Expand Up @@ -1088,7 +1098,7 @@ static bool ProcessorCanRunCurrentBuild()
return true;
}

static bool SystemCanRunCurrentBuild()
static bool SystemCanRunCurrentBuild()
{
if(mpt::OS::Windows::IsOriginal())
{
Expand Down

0 comments on commit 63e38ae

Please sign in to comment.