Compare commits

...

1 Commits

Author SHA1 Message Date
Dmitriy Kovalenko 9db2fb651e fix: Download lua script
docs / docs (push) Has been cancelled
2025-12-18 21:16:51 -08:00
3 changed files with 35 additions and 33 deletions
+2 -2
View File
@@ -1,5 +1,6 @@
local M = {}
local system = require('fff.utils.system')
local fs_utils = require('fff.utils.fs')
local GITHUB_REPO = 'dmtrKovalenko/fff.nvim'
@@ -31,8 +32,7 @@ local function download_file(url, output_path, opts, callback)
opts = opts or {}
local dir = vim.fn.fnamemodify(output_path, ':h')
mkdir_recursive(dir, function(mkdir_ok, mkdir_err)
fs_utils.mkdir_recursive(dir, function(mkdir_ok, mkdir_err)
if not mkdir_ok then
callback(false, mkdir_err)
return
-31
View File
@@ -59,35 +59,4 @@ function M.is_one_of(value, values)
return false
end
-- Recursively create directories using uv.fs_mkdir
local function mkdir_recursive(path, callback)
vim.uv.fs_stat(path, function(err, stat)
if not err and stat then
callback(true, nil)
return
end
local parent = vim.fn.fnamemodify(path, ':h')
if parent == path or parent == '' or parent == '.' then
callback(false, 'Cannot create root directory')
return
end
mkdir_recursive(parent, function(parent_ok, parent_err)
if not parent_ok then
callback(false, parent_err)
return
end
uv.fs_mkdir(path, 493, function(mkdir_err) -- 493 = 0755 octal
if mkdir_err and not mkdir_err:match('EEXIST') then
callback(false, 'Failed to create directory: ' .. mkdir_err)
return
end
callback(true, nil)
end)
end)
end)
end
return M
+33
View File
@@ -0,0 +1,33 @@
local M = {}
function M.mkdir_recursive(path, callback)
vim.uv.fs_stat(path, function(err, stat)
if not err and stat then
callback(true, nil)
return
end
local parent = vim.fn.fnamemodify(path, ':h')
if parent == path or parent == '' or parent == '.' then
callback(false, 'Cannot create root directory')
return
end
M.mkdir_recursive(parent, function(parent_ok, parent_err)
if not parent_ok then
callback(false, parent_err)
return
end
vim.uv.fs_mkdir(path, 493, function(mkdir_err) -- 493 = 0755 octal
if mkdir_err and not mkdir_err:match('EEXIST') then
callback(false, 'Failed to create directory: ' .. mkdir_err)
return
end
callback(true, nil)
end)
end)
end)
end
return M