fix: revert relative path (#524)

This commit is contained in:
Kiyan
2021-07-19 23:54:40 +02:00
committed by GitHub
parent 42b23246bc
commit 07e92cd59b
2 changed files with 7 additions and 9 deletions

View File

@@ -41,12 +41,10 @@ end
local function file_new(cwd, name)
local absolute_path = utils.path_join({cwd, name})
local relative_path = utils.path_relative(absolute_path, luv.cwd())
local is_exec = luv.fs_access(absolute_path, 'X')
return {
name = name,
absolute_path = absolute_path,
relative_path = relative_path,
executable = is_exec,
extension = string.match(name, ".?[^.]+%.(.*)") or "",
match_name = path_to_matching_str(name),
@@ -64,8 +62,6 @@ local function link_new(cwd, name)
--- I dont know if this is needed, because in my understanding, there isnt hard links in windows, but just to be sure i changed it.
local absolute_path = utils.path_join({ cwd, name })
local link_to = luv.fs_realpath(absolute_path)
-- if links to a file outside cwd, relative_path equals absolute_path
local relative_path = link_to ~= nil and utils.path_relative(link_to, luv.cwd()) or nil
local stat = luv.fs_stat(absolute_path)
local open, entries
if (link_to ~= nil) and luv.fs_stat(link_to).type == 'directory' then
@@ -81,7 +77,6 @@ local function link_new(cwd, name)
return {
name = name,
absolute_path = absolute_path,
relative_path = relative_path,
link_to = link_to,
last_modified = last_modified,
open = open,