Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
77521c4b
Commit
77521c4b
authored
Nov 11, 2011
by
Wayne Stambaugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix write file bug when file is in the project path and no path is defined.
parent
4221c361
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
basicframe.cpp
common/basicframe.cpp
+17
-9
No files found.
common/basicframe.cpp
View file @
77521c4b
...
...
@@ -542,27 +542,35 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event )
bool
EDA_BASE_FRAME
::
IsWritable
(
const
wxFileName
&
aFileName
)
{
wxString
msg
;
wxFileName
fn
=
aFileName
;
wxCHECK_MSG
(
aFileName
.
IsOk
(),
false
,
// Check for absence of a file path with a file name. Unfortunately KiCad
// uses paths relative to the current project path without the ./ part which
// confuses wxFileName. Making the file name path absolute may be less than
// elegant but it solves the problem.
if
(
fn
.
GetPath
().
IsEmpty
()
&&
fn
.
HasName
()
)
fn
.
MakeAbsolute
();
wxCHECK_MSG
(
fn
.
IsOk
(),
false
,
wxT
(
"File name object is invalid. Bad programmer!"
)
);
wxCHECK_MSG
(
!
aFileName
.
GetPath
().
IsEmpty
(),
false
,
wxT
(
"File name object path <"
)
+
aFileName
.
GetFullPath
()
+
wxCHECK_MSG
(
!
fn
.
GetPath
().
IsEmpty
(),
false
,
wxT
(
"File name object path <"
)
+
fn
.
GetFullPath
()
+
wxT
(
"> is not set. Bad programmer!"
)
);
if
(
aFileName
.
IsDir
()
&&
!
aFileName
.
IsDirWritable
()
)
if
(
fn
.
IsDir
()
&&
!
fn
.
IsDirWritable
()
)
{
msg
.
Printf
(
_
(
"You do not have write permissions to folder <%s>."
),
GetChars
(
aFileName
.
GetPath
()
)
);
GetChars
(
fn
.
GetPath
()
)
);
}
else
if
(
!
aFileName
.
FileExists
()
&&
!
aFileName
.
IsDirWritable
()
)
else
if
(
!
fn
.
FileExists
()
&&
!
fn
.
IsDirWritable
()
)
{
msg
.
Printf
(
_
(
"You do not have write permissions to save file <%s> to folder <%s>."
),
GetChars
(
aFileName
.
GetFullName
()
),
GetChars
(
aFileName
.
GetPath
()
)
);
GetChars
(
fn
.
GetFullName
()
),
GetChars
(
fn
.
GetPath
()
)
);
}
else
if
(
aFileName
.
FileExists
()
&&
!
aFileName
.
IsFileWritable
()
)
else
if
(
fn
.
FileExists
()
&&
!
fn
.
IsFileWritable
()
)
{
msg
.
Printf
(
_
(
"You do not have write permissions to save file <%s>."
),
GetChars
(
aFileName
.
GetFullPath
()
)
);
GetChars
(
fn
.
GetFullPath
()
)
);
}
if
(
!
msg
.
IsEmpty
()
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment