diff options
| author | Josh Andler <scislac@gmail.com> | 2009-09-16 02:04:50 +0000 |
|---|---|---|
| committer | scislac <scislac@users.sourceforge.net> | 2009-09-16 02:04:50 +0000 |
| commit | 1807c74cbec5204385b71b3a120ebcd40f80c18e (patch) | |
| tree | 4acd4e7edddf85e9a027230a382134ed12cbf3b7 /src/extension | |
| parent | Swedish translation update by Elias. (diff) | |
| download | inkscape-1807c74cbec5204385b71b3a120ebcd40f80c18e.tar.gz inkscape-1807c74cbec5204385b71b3a120ebcd40f80c18e.zip | |
Fix by Adib for 353847
(bzr r8601)
Diffstat (limited to 'src/extension')
| -rw-r--r-- | src/extension/output.h | 1 | ||||
| -rw-r--r-- | src/extension/system.cpp | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/extension/output.h b/src/extension/output.h index b52a96211..584fafda8 100644 --- a/src/extension/output.h +++ b/src/extension/output.h @@ -31,6 +31,7 @@ public: class save_failed {}; /**< Generic failure for an undescribed reason */ class save_cancelled {}; /**< Saving was cancelled */ class no_extension_found {}; /**< Failed because we couldn't find an extension to match the filename */ + class file_read_only {}; /**< The existing file can not be opened for writing */ Output (Inkscape::XML::Node * in_repr, Implementation::Implementation * in_imp); diff --git a/src/extension/system.cpp b/src/extension/system.cpp index 365ea925b..43e7af494 100644 --- a/src/extension/system.cpp +++ b/src/extension/system.cpp @@ -32,6 +32,7 @@ #include "implementation/script.h" #include "implementation/xslt.h" #include "xml/rebase-hrefs.h" +#include "io/sys.h" /* #include "implementation/plugin.h" */ namespace Inkscape { @@ -248,6 +249,13 @@ save(Extension *key, SPDocument *doc, gchar const *filename, bool setextension, throw Output::no_overwrite(); } + // test if the file exists and is writable + // the test only checks the file attributes and might pass where ACL does not allow to write + if (Inkscape::IO::file_test(filename, G_FILE_TEST_EXISTS) && !Inkscape::IO::file_is_writable(filename)) { + g_free(fileName); + throw Output::file_read_only(); + } + Inkscape::XML::Node *repr = sp_document_repr_root(doc); |
