From: Steinar H. Gunderson Date: Wed, 12 Apr 2017 17:04:46 +0000 (+0200) Subject: Make search_for_file() understand URLs. X-Git-Tag: 1.6.0~56 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=63f0f22270455648d31a190089be58317a45b9cd;p=nageru Make search_for_file() understand URLs. --- diff --git a/image_input.cpp b/image_input.cpp index e763ad5..a3a110c 100644 --- a/image_input.cpp +++ b/image_input.cpp @@ -44,6 +44,17 @@ string search_for_file(const string &filename) return filename; } + // See if we match ^[a-z]:/, which is probably a URL of some sort + // (FFmpeg understands various forms of these). + for (size_t i = 0; i < filename.size() - 1; ++i) { + if (filename[i] == ':' && filename[i + 1] == '/') { + return filename; + } + if (!isalpha(filename[i])) { + break; + } + } + // Look for the file in all theme_dirs until we find one; // that will be the permanent resolution of this file, whether // it is actually valid or not.