Skip to content

Commit 2d1de9d

Browse files
committed
fix glob on windows, with slight regression
1 parent ddd98d6 commit 2d1de9d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/DatasetAPI/Datasets.jl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,17 @@ testrange(x::AbstractArray{<:TimeType}) = x
331331

332332
testrange(x::AbstractArray{<:AbstractString}) = x
333333

334-
_glob(x) = startswith(x, "/") ? glob(x[2:end], "/") : glob(x)
334+
335+
# This is a bit unfortunate since it will disallow globbing hierarchies of directories,
336+
# but necessary to have it work on both windows and Unix systems
337+
function _glob(x)
338+
if isabspath(x)
339+
p, rest = splitdir(x)
340+
glob(rest,p)
341+
else
342+
glob(x)
343+
end
344+
end
335345

336346
open_mfdataset(g::AbstractString; kwargs...) = open_mfdataset(_glob(g); kwargs...)
337347
open_mfdataset(g::Vector{<:AbstractString}; kwargs...) =

0 commit comments

Comments
 (0)