Don't change a shortcut file name when changing its path.
wxFileName::MakeRelativeTo() is only supposed to change the path of the file, not its name, but it was doing the latter for the shortcuts as it implicitly resolved them to the name of their target. Fix this by ensuring we do not use wxPATH_NORM_SHORTCUT in MakeRelativeTo(). Closes #16239. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77509 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1752,8 +1752,13 @@ bool wxFileName::MakeRelativeTo(const wxString& pathBase, wxPathFormat format)
|
||||
|
||||
// get cwd only once - small time saving
|
||||
wxString cwd = wxGetCwd();
|
||||
Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_CASE, cwd, format);
|
||||
fnBase.Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_CASE, cwd, format);
|
||||
|
||||
// Normalize the paths but avoid changing the case or turning a shortcut
|
||||
// into a file that it points to.
|
||||
const int normFlags = wxPATH_NORM_ALL &
|
||||
~(wxPATH_NORM_CASE | wxPATH_NORM_SHORTCUT);
|
||||
Normalize(normFlags, cwd, format);
|
||||
fnBase.Normalize(normFlags, cwd, format);
|
||||
|
||||
bool withCase = IsCaseSensitive(format);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user