From a1eeb933413ce14b671d60ea5659b53aa59a71ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laurent?= <francois.laurent@posteo.net> Date: Wed, 16 Apr 2025 17:30:21 +0200 Subject: [PATCH] fix: open changes dir to the target file's parent directory to prevent exporting label files in current directory when tracking data file is not a descendant --- src/cli_open.jl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cli_open.jl b/src/cli_open.jl index cdb08e2..900d9a4 100644 --- a/src/cli_open.jl +++ b/src/cli_open.jl @@ -54,8 +54,14 @@ function main(args=ARGS; exit_on_error=false) infile = parsed_args["<file-path>"] if isempty(infile) infile = nothing - elseif !(startswith(infile, "http://") || isfile(infile)) - if isdir(infile) + elseif !startswith(infile, "http://") + if isfile(infile) + dataroot = dirname(infile) + if !isempty(dataroot) + cd(dataroot) + infile = basename(infile) + end + elseif isdir(infile) dataroot = infile infile = nothing cd(dataroot) -- GitLab