__fish_data_list_files: fix for installed builds

This is only used in test code where bad output is ignored.
To be tested by a following commit.
This commit is contained in:
Johannes Altmanninger
2025-10-13 15:51:16 +02:00
parent 3b52d3db42
commit 441f90fb55
2 changed files with 6 additions and 2 deletions

View File

@@ -9,7 +9,7 @@ function __fish_data_list_files
set dir $__fish_data_dir
end
set -l files $dir/**
string replace -- $dir/ '' $files
string replace -- $__fish_data_dir/ '' $files
else
status list-files $dir
end

View File

@@ -3,7 +3,11 @@ function __fish_data_with_file
set -l path $argv[1]
set -l cmd $argv[2..]
if set -q __fish_data_dir[1]
$cmd $__fish_data_dir/$path
if not string match -rq -- ^/ $path
echo >&2 "error: $(status function) requires absolute paths on non-embedded builds"
return 1
end
$cmd $path
else
status get-file $path | $cmd
end