Avoid generating paths on windows with ".." in them

This causes wxwidgets to failover to legacy windows dialogs as windows doesn't know how to handle them being passed to dialogs.
This commit is contained in:
Marek Roszko
2021-06-21 18:03:55 -04:00
parent 6d223931fb
commit aadb62bd42
2 changed files with 23 additions and 3 deletions
+14 -3
View File
@@ -154,7 +154,7 @@ wxString PATHS::GetStockDataPath( bool aRespectRunFromBuildDir )
fn.RemoveLastDir();
path = fn.GetPath();
#else
path = Pgm().GetExecutablePath() + wxT( ".." );
path = getWindowsKiCadRoot();
#endif
}
else
@@ -162,7 +162,7 @@ wxString PATHS::GetStockDataPath( bool aRespectRunFromBuildDir )
#if defined( __WXMAC__ )
path = GetOSXKicadDataDir();
#elif defined( __WXMSW__ )
path = Pgm().GetExecutablePath() + wxT( "../share/kicad" );
path = getWindowsKiCadRoot() + wxT( "share/kicad" );
#else
path = wxString::FromUTF8Unchecked( KICAD_DATA );
#endif
@@ -257,7 +257,7 @@ wxString PATHS::GetDocumentationPath()
#if defined( __WXMAC__ )
path = GetOSXKicadDataDir();
#elif defined( __WXMSW__ )
path = Pgm().GetExecutablePath() + "../share/doc/kicad";
path = getWindowsKiCadRoot() + "share/doc/kicad";
#else
path = wxString::FromUTF8Unchecked( KICAD_DOCS );
#endif
@@ -345,3 +345,14 @@ wxString PATHS::GetOSXKicadDataDir()
return ddir.GetPath();
}
#endif
#ifdef __WXWINDOWS__
wxString PATHS::getWindowsKiCadRoot()
{
wxFileName root(Pgm().GetExecutablePath() + "/../");
root.MakeAbsolute();
return root.GetPathWithSep();
}
#endif