From 29afc301ea05bc907444b698c91b141c26167baa Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Sat, 11 Jan 2025 15:11:16 +0100 Subject: make universal root detection opt-in --- util.lua | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'util.lua') diff --git a/util.lua b/util.lua index 114aad4..8d9df9b 100644 --- a/util.lua +++ b/util.lua @@ -123,6 +123,13 @@ function util.get_relative_path(cwd_components, absolute_path_or_components) return dir:sub(2) end +--- Strip the last component from a pathname +-- @param the pathname +-- @return the pathname up to the last '/' +function util.dirname(name) + return name:match('(.*[/])') +end + --- Create an iterator yielding the nth line of a file -- -- @param path The path to the file -- cgit v1.2.3