From 3592b1f8b0ca207462bf945af52026e592afda30 Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Mon, 28 Sep 2020 17:03:59 -0400 Subject: fix: 126 --- lua/telescope/utils.lua | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) (limited to 'lua/telescope/utils.lua') diff --git a/lua/telescope/utils.lua b/lua/telescope/utils.lua index 28e79e0..9d948ce 100644 --- a/lua/telescope/utils.lua +++ b/lua/telescope/utils.lua @@ -1,11 +1,10 @@ +local pathlib = require('telescope.path') + local utils = {} -utils.get_separator = (function() - local val = package.config:sub(1, 1) - return function() - return val - end -end)() +utils.get_separator = function() + return pathlib.separator +end utils.if_nil = function(x, was_nil, was_not_nil) if x == nil then @@ -97,29 +96,7 @@ end -- return result -- end or nil) -utils.path_shorten = (function() - if jit then - local ffi = require('ffi') - ffi.cdef [[ - typedef unsigned char char_u; - char_u *shorten_dir(char_u *str); - ]] - - return function(path) - if not path then - return path - end - - local c_str = ffi.new("char[?]", #path + 1) - ffi.copy(c_str, path) - return ffi.string(ffi.C.shorten_dir(c_str)) - end - else - return function(path) - return path - end - end -end)() +utils.path_shorten = pathlib.shorten utils.path_tail = (function() local os_sep = utils.get_separator() -- cgit v1.2.3