Skip to content

Commit fbb48f6

Browse files
authored
fix gdal file load on windows (#437)
1 parent c6f4a24 commit fbb48f6

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/sources/gdal.jl

+11-9
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,17 @@ function create(filename, ::Type{GDALsource}, T::Type, dims::DD.DimTuple;
126126
end
127127

128128
function _open(f, ::Type{GDALsource}, filename::AbstractString; write=false, kw...)
129-
# Handle url filenames
130-
# /vsicurl/ is added to urls for GDAL, /vsimem/ for in memory
131-
if length(filename) >= 8 && filename[1:8] in ("/vsicurl", "/vsimem/")
132-
nothing
133-
elseif _isurl(filename)
134-
filename = "/vsicurl/" * filename
135-
else
136-
# check the file actually exists because GDALs error is unhelpful
137-
isfile(filename) || _filenotfound_error(filename)
129+
if !isfile(filename)
130+
# Handle url filenames
131+
# /vsicurl/ is added to urls for GDAL, /vsimem/ for in memory
132+
if length(filename) >= 8 && filename[1:8] in ("/vsicurl", "/vsimem/")
133+
nothing
134+
elseif _isurl(filename)
135+
filename = "/vsicurl/" * filename
136+
else
137+
# check the file actually exists because GDALs error is unhelpful
138+
_filenotfound_error(filename)
139+
end
138140
end
139141
flags = write ? (; flags=AG.OF_UPDATE) : ()
140142
AG.readraster(cleanreturn f, filename; flags...)

0 commit comments

Comments
 (0)