From 449d3ca32d39af9699e9ced12dc29385304aca11 Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Mon, 4 Sep 2017 23:35:41 +0200 Subject: [PATCH] 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 --- libgnucash/core-utils/gnc-filepath-utils.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libgnucash/core-utils/gnc-filepath-utils.cpp b/libgnucash/core-utils/gnc-filepath-utils.cpp index 8bbca8d3fe..35481c35e8 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,