xDg

git clone git://xatko.vsos.ethz.ch/xDg.git
Log | Files | Refs

commit 9f45f0e32bce0e7db19d39c010daa216e9df6733
parent bce9f11ef24fd806d42bdd88149ee37658aba3e4
Author: Dominik Schmidt <dominik@schm1dt.ch>
Date:   Thu, 18 Mar 2021 15:16:19 +0100

Make uri-match more idiomatic

Diffstat:
Msrc/open.d | 11+++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/open.d b/src/open.d @@ -9,14 +9,13 @@ import std.algorithm:splitter; import std.format; bool is_file_url_or_path(in char[] uri){ - if(uri.startsWith("file://")){ - return true; + auto r = ctRegex!(`^(\w[\w+-\.]*)://`); + if(auto match = uri.matchFirst(r)){ + return match[1] == "file"; } - auto r = ctRegex!(`^\w[\w+-\.]*:`); - if(uri.matchFirst(r)){ - return false; + else{ + return true; } - return true; } struct Opener{