From 366805e7463dff4a9cd0250b0f093709250c1bc3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Laurent?= <francois.laurent@posteo.net>
Date: Thu, 8 Jun 2023 16:54:49 +0200
Subject: [PATCH] fixes #15 and #16

---
 Project.toml    | 2 +-
 src/Datasets.jl | 2 +-
 src/Formats.jl  | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Project.toml b/Project.toml
index 8fa5ad3..d27e9f8 100644
--- a/Project.toml
+++ b/Project.toml
@@ -1,7 +1,7 @@
 name = "PlanarLarvae"
 uuid = "c2615984-ef14-4d40-b148-916c85b43307"
 authors = ["François Laurent", "Institut Pasteur"]
-version = "0.11.1"
+version = "0.11.2"
 
 [deps]
 DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
diff --git a/src/Datasets.jl b/src/Datasets.jl
index 2b171bf..2f1d85c 100644
--- a/src/Datasets.jl
+++ b/src/Datasets.jl
@@ -1254,7 +1254,7 @@ function getdependencies(run::Run, filepath=nothing)
     deps = String[]
     for dep in object_or_array_of_objects(run.attributes[:dependencies])
         datafile = dep[:filename]
-        if !isfile(datafile)
+        if !isnothing(filepath)
             dirpath = isdir(filepath) ? filepath : dirname(filepath)
             datafile = joinpath(dirpath, datafile)
         end
diff --git a/src/Formats.jl b/src/Formats.jl
index 7a39e9a..81834c2 100644
--- a/src/Formats.jl
+++ b/src/Formats.jl
@@ -689,13 +689,13 @@ The returned array of files can be muted.
 """
 find_associated_files(file::String) = find_associated_files(preload(file))
 
-function find_associated_files(files::Vector{String})
-    unique(find_associated_files.(files)) do f
+function find_associated_files(files::AbstractVector)
+    unique(Iterators.flatmap(find_associated_files, files)) do f
         f.source
     end
 end
 
-find_associated_files(file) = PreloadedFile[file]
+find_associated_files(file::PreloadedFile) = PreloadedFile[file]
 
 function find_associated_files(file::JSONLabels)
     getdependencies!(file)
-- 
GitLab