How can I convert a Windows dir path (say c:/libs/Qt-static) to the correct POSIX dir path (/c/libs/Qt-static) by means of standard msys features? And vice versa?
How can I convert a Windows dir path (say c:/libs/Qt-static ) to the correct
Share
I don’t know
msys, but a quick google search showed me that it includes thesedutility. So, assuming it works similar inmsysthan it does on native Linux, here’s one way how to do it:From Windows to POSIX
You’ll have to replace all backslashes with slashes, remove the first colon after the drive letter, and add a slash at the beginning:
or, as noted by xaizek,
From POSIX to Windows
You’ll have to add a semi-colon, remove the first slash and replace all slashes with backslashes:
or more efficiently,
where
$pthis a variable storing the Windows or POSIX path, respectively.