From 6c8a2ec05b62e24ecde1834387c8a5b8f7ed2326 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 14 May 2025 20:21:27 +0200 Subject: [PATCH] Fix false read-only detection of sessions on Windows with OneDrive see https://discourse.ardour.org/t/ardour-8-4-on-win11-amd64-always-opens-session-in-read-only-mode/110063/38?u=x42 --- libs/pbd/file_utils.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/pbd/file_utils.cc b/libs/pbd/file_utils.cc index e8dfb9f933..aed050e694 100644 --- a/libs/pbd/file_utils.cc +++ b/libs/pbd/file_utils.cc @@ -526,11 +526,14 @@ exists_and_writable (const std::string & p) /* doesn't exist - not writable */ return false; } else { +#ifndef PLATFORM_WINDOWS + /* Folders on Windows fail this test if they're on OneDrive */ DEBUG_TRACE (DEBUG::FileUtils, string_compose("exists_and_writable stat '%1': %2 \n", p, statbuf.st_mode)); if (!(statbuf.st_mode & S_IWUSR)) { /* exists and is not writable */ return false; } +#endif /* filesystem may be mounted read-only, so even though file * permissions permit access, the mount status does not. * access(2) seems like the best test for this.