Commit 04174ecd authored by charras's avatar charras

Solved: path problems when Kicad is installed on a server (Windows or Samba server)

parent 46d816fd
......@@ -442,10 +442,15 @@ bool WinEDA_App::SetBinDir()
m_BinDir = argv[0];
#endif /* __UNIX__ */
m_BinDir.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
while( m_BinDir.Last() != '/' )
while( m_BinDir.Last() != DIR_SEP )
m_BinDir.RemoveLast();
/* Use unix notation for paths. I am not sure this is a good idea,
* but it simplify compatibility between Windows and Unices
* However it is a potential problem in path handling under Windows
*/
m_BinDir.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
wxFileName pfn( wxT( "/posix/path/specification" ), wxT( "filename" ) );
wxFileName wfn( wxT( "\\windows\\path\\specification" ), wxT( "filename" ) );
wxLogDebug( wxT( "Posix path: " ) + pfn.GetFullPath() );
......@@ -464,8 +469,18 @@ bool WinEDA_App::SetBinDir()
void WinEDA_App::SetDefaultSearchPaths( void )
{
size_t i;
wxString path;
wxFileName fn( m_BinDir, wxEmptyString );
wxString path = m_BinDir;
#ifdef __WINDOWS__
/* m_BinDir path is in unix notation.
* But wxFileName expect (to work fine) native notation
* specifically when using a path including a server, like \\myserver\local_path .
*/
path.Replace( UNIX_STRING_DIR_SEP, WIN_STRING_DIR_SEP );
#endif
wxFileName fn( path, wxEmptyString );
/* User environment variable path is the first search path. Chances are
* if the user is savvy enough to set an environment variable they know
......@@ -479,7 +494,9 @@ void WinEDA_App::SetDefaultSearchPaths( void )
/* Standard application data path if it is different from the binary
* path. */
if( fn.GetPath() != GetTraits()->GetStandardPaths().GetDataDir() )
{
m_searchPaths.Add( GetTraits()->GetStandardPaths().GetDataDir() );
}
/* Up on level relative to binary path with "share" appended for Windows. */
fn.RemoveLastDir();
......@@ -745,9 +762,9 @@ void WinEDA_App::SetLanguagePath( void )
fn.GetPath() );
wxLocale::AddCatalogLookupPathPrefix( fn.GetPath() );
}
fn.RemoveLastDir();
// Append path for unix standard install
fn.RemoveLastDir();
fn.AppendDir( wxT( "kicad" ) );
fn.AppendDir( wxT( "internat" ) );
if( fn.DirExists() )
......@@ -832,6 +849,7 @@ wxString WinEDA_App::FindFileInSearchPaths( const wxString& filename,
for( j = 0; j < subdirs->GetCount(); j++ )
fn.AppendDir( subdirs->Item( j ) );
}
if( fn.DirExists() )
{
wxLogDebug( _T( "Adding <" ) + fn.GetPath() + _T( "> to " ) +
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment