gnucash master: Windows: check permissions actually used on the platform
Geert Janssens
gjanssens at code.gnucash.org
Mon Sep 4 18:14:52 EDT 2017
Updated via https://github.com/Gnucash/gnucash/commit/449d3ca3 (commit)
from https://github.com/Gnucash/gnucash/commit/d96bb3eb (commit)
commit 449d3ca32d39af9699e9ced12dc29385304aca11
Author: Geert Janssens <geert at kobaltwit.be>
Date: Mon Sep 4 23:35:41 2017 +0200
Windows: check permissions actually used on the platform
The code assumed these would be the same as on all other platforms which turns out not to be the case
diff --git a/libgnucash/core-utils/gnc-filepath-utils.cpp b/libgnucash/core-utils/gnc-filepath-utils.cpp
index 8bbca8d..35481c3 100644
--- a/libgnucash/core-utils/gnc-filepath-utils.cpp
+++ b/libgnucash/core-utils/gnc-filepath-utils.cpp
@@ -335,7 +335,12 @@ gnc_validate_directory (const bfs::path &dirname, bool create)
/* On Windows only write permission will be checked.
* So strictly speaking we'd need two error messages here depending
* on the platform. For simplicity this detail is glossed over though. */
- if ((perms & bfs::owner_all) != bfs::owner_all)
+#if PLATFORM(WINDOWS)
+ auto check_perms = bfs::owner_read | bfs::owner_write;
+#else
+ auto check_perms = bfs::owner_all;
+#endif
+ if ((perms & check_perms) != check_perms)
throw (bfs::filesystem_error(
std::string(_("Insufficient permissions, at least write and access permissions required: "))
+ dirname.string(), dirname,
Summary of changes:
libgnucash/core-utils/gnc-filepath-utils.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
More information about the gnucash-changes
mailing list