From b3aee84a8ebbcb4e7b29ef04b863a3833fcfe99f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 6 Nov 2026 17:53:02 +0100 Subject: [PATCH] Path: Recognize content URIs on every platform So code that handles them can be tested anywhere. Elsewhere, file operations on them just fail, as they did when they were taken for native paths. Co-Authored-By: Claude Opus 5.5 --- Common/File/Path.cpp | 4 +++- Common/File/Path.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Common/File/Path.cpp b/Common/File/Path.cpp index 6e141da4b6..71172c5006 100644 --- a/Common/File/Path.cpp +++ b/Common/File/Path.cpp @@ -41,7 +41,9 @@ void Path::Init(std::string_view str) { } else if (startsWith(str, "http://") || startsWith(str, "https://")) { type_ = PathType::HTTP; path_ = str; - } else if (Android_IsContentUri(str)) { + } else if (startsWith(str, "content://")) { + // Recognized on every platform, so code that handles them can be tested anywhere. Elsewhere, file + // operations on them just fail. // Content URIs on non scoped-storage (and possibly other cases?) can contain // "raw:/" URIs inside. This happens when picking the Download folder using the folder browser // on Android 9. diff --git a/Common/File/Path.h b/Common/File/Path.h index 534a93e2a0..7ae4c21bd9 100644 --- a/Common/File/Path.h +++ b/Common/File/Path.h @@ -32,7 +32,7 @@ enum class PathType { UNDEFINED = 0, NATIVE = 1, // Can be relative. - CONTENT_URI = 2, // Android only. Can only be absolute! + CONTENT_URI = 2, // Android storage. Recognized everywhere, but only usable on Android. Can only be absolute! HTTP = 3, // http://, https:// };