From b2b86d2e04414eed8731b820b2e75964092c5c83 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 27 Oct 2011 20:38:31 +0200 Subject: [PATCH] Fix erroneous test for non writable folder, when trying to save a schematic file with no path in name. (seems wxFileName.IsDirWritable() fails under Windows when the path is empty (does not use the CWD).) --- common/basicframe.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/common/basicframe.cpp b/common/basicframe.cpp index e72f719cbc..8c17b83142 100644 --- a/common/basicframe.cpp +++ b/common/basicframe.cpp @@ -550,10 +550,18 @@ bool EDA_BASE_FRAME::IsWritable( const wxFileName& aFileName ) msg.Printf( _( "You do not have write permissions to folder <%s>." ), GetChars( aFileName.GetPath() ) ); } - else if( !aFileName.FileExists() && !aFileName.IsDirWritable() ) + else if( !aFileName.FileExists() ) { - msg.Printf( _( "You do not have write permissions to save file <%s> to folder <%s>." ), - GetChars( aFileName.GetFullName() ), GetChars( aFileName.GetPath() ) ); + // Extract filename path, and if void, uses the CWD + // because IsDirWritable does not like void path + wxString filedir = aFileName.GetPath(); + if( filedir.IsEmpty() ) + filedir = wxGetCwd(); + if( !aFileName.IsDirWritable(filedir) ) + { + msg.Printf( _( "You do not have write permissions to save file <%s> to folder <%s>." ), + GetChars( aFileName.GetFullName() ), GetChars( filedir ) ); + } } else if( aFileName.FileExists() && !aFileName.IsFileWritable() ) {