Solved: path problems when Kicad is installed on a server (Windows or Samba server)
This commit is contained in:
parent
46d816fd4d
commit
04174ecd10
|
@ -442,10 +442,15 @@ bool WinEDA_App::SetBinDir()
|
||||||
m_BinDir = argv[0];
|
m_BinDir = argv[0];
|
||||||
#endif /* __UNIX__ */
|
#endif /* __UNIX__ */
|
||||||
|
|
||||||
m_BinDir.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
while( m_BinDir.Last() != DIR_SEP )
|
||||||
while( m_BinDir.Last() != '/' )
|
|
||||||
m_BinDir.RemoveLast();
|
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 pfn( wxT( "/posix/path/specification" ), wxT( "filename" ) );
|
||||||
wxFileName wfn( wxT( "\\windows\\path\\specification" ), wxT( "filename" ) );
|
wxFileName wfn( wxT( "\\windows\\path\\specification" ), wxT( "filename" ) );
|
||||||
wxLogDebug( wxT( "Posix path: " ) + pfn.GetFullPath() );
|
wxLogDebug( wxT( "Posix path: " ) + pfn.GetFullPath() );
|
||||||
|
@ -464,8 +469,18 @@ bool WinEDA_App::SetBinDir()
|
||||||
void WinEDA_App::SetDefaultSearchPaths( void )
|
void WinEDA_App::SetDefaultSearchPaths( void )
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
wxString path;
|
wxString path = m_BinDir;
|
||||||
wxFileName fn( m_BinDir, wxEmptyString );
|
|
||||||
|
#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
|
/* User environment variable path is the first search path. Chances are
|
||||||
* if the user is savvy enough to set an environment variable they know
|
* 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
|
/* Standard application data path if it is different from the binary
|
||||||
* path. */
|
* path. */
|
||||||
if( fn.GetPath() != GetTraits()->GetStandardPaths().GetDataDir() )
|
if( fn.GetPath() != GetTraits()->GetStandardPaths().GetDataDir() )
|
||||||
|
{
|
||||||
m_searchPaths.Add( GetTraits()->GetStandardPaths().GetDataDir() );
|
m_searchPaths.Add( GetTraits()->GetStandardPaths().GetDataDir() );
|
||||||
|
}
|
||||||
|
|
||||||
/* Up on level relative to binary path with "share" appended for Windows. */
|
/* Up on level relative to binary path with "share" appended for Windows. */
|
||||||
fn.RemoveLastDir();
|
fn.RemoveLastDir();
|
||||||
|
@ -745,9 +762,9 @@ void WinEDA_App::SetLanguagePath( void )
|
||||||
fn.GetPath() );
|
fn.GetPath() );
|
||||||
wxLocale::AddCatalogLookupPathPrefix( fn.GetPath() );
|
wxLocale::AddCatalogLookupPathPrefix( fn.GetPath() );
|
||||||
}
|
}
|
||||||
fn.RemoveLastDir();
|
|
||||||
|
|
||||||
// Append path for unix standard install
|
// Append path for unix standard install
|
||||||
|
fn.RemoveLastDir();
|
||||||
fn.AppendDir( wxT( "kicad" ) );
|
fn.AppendDir( wxT( "kicad" ) );
|
||||||
fn.AppendDir( wxT( "internat" ) );
|
fn.AppendDir( wxT( "internat" ) );
|
||||||
if( fn.DirExists() )
|
if( fn.DirExists() )
|
||||||
|
@ -832,6 +849,7 @@ wxString WinEDA_App::FindFileInSearchPaths( const wxString& filename,
|
||||||
for( j = 0; j < subdirs->GetCount(); j++ )
|
for( j = 0; j < subdirs->GetCount(); j++ )
|
||||||
fn.AppendDir( subdirs->Item( j ) );
|
fn.AppendDir( subdirs->Item( j ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fn.DirExists() )
|
if( fn.DirExists() )
|
||||||
{
|
{
|
||||||
wxLogDebug( _T( "Adding <" ) + fn.GetPath() + _T( "> to " ) +
|
wxLogDebug( _T( "Adding <" ) + fn.GetPath() + _T( "> to " ) +
|
||||||
|
|
Loading…
Reference in New Issue