Browse Source

Write through symlinks for schematics and PCBs

6.0.7
Johannes Maibaum 4 years ago
committed by Jeff Young
parent
commit
542c02046b
  1. 12
      eeschema/files-io.cpp
  2. 12
      pcbnew/files.cpp

12
eeschema/files-io.cpp

@ -109,6 +109,18 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SHEET* aSheet, bool aSaveUnderNewName )
schematicFileName.SetExt( KiCadSchematicFileExtension );
}
#ifndef __WINDOWS__
// Write through symlinks, don't replace them
if( schematicFileName.Exists( wxFILE_EXISTS_SYMLINK ) )
{
char buffer[ PATH_MAX ];
char *realPath = realpath( TO_UTF8( schematicFileName.GetFullPath() ), buffer );
if( realPath )
schematicFileName.Assign( wxString::FromUTF8( realPath ) );
}
#endif
if( !IsWritable( schematicFileName ) )
return false;

12
pcbnew/files.cpp

@ -943,6 +943,18 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool addToHistory,
if( pcbFileName.GetExt() == LegacyPcbFileExtension )
pcbFileName.SetExt( KiCadPcbFileExtension );
#ifndef __WINDOWS__
// Write through symlinks, don't replace them
if( pcbFileName.Exists( wxFILE_EXISTS_SYMLINK ) )
{
char buffer[ PATH_MAX ];
char *realPath = realpath( TO_UTF8( pcbFileName.GetFullPath() ), buffer );
if( realPath )
pcbFileName.Assign( wxString::FromUTF8( realPath ) );
}
#endif
if( !IsWritable( pcbFileName ) )
{
wxString msg = wxString::Format( _( "No access rights to write to file \"%s\"" ),

Loading…
Cancel
Save