upload root dir

This commit is contained in:
cdricms
2025-03-13 00:28:03 +01:00
parent 9ec1860ca7
commit c9f4d70c56

View File

@@ -134,14 +134,11 @@ function M.UploadFile()
local remotePath = config.remote_path .. relative_path local remotePath = config.remote_path .. relative_path
print("remotePath:", remotePath)
print("current_buffer_path:", current_buffer_path)
local dir = dirname(remotePath) local dir = dirname(remotePath)
local command = string.format( local command = string.format(
"lftp -u '%s,%s' ftp://%s -e 'set ssl:verify-certificate no;mkdir -p %s; cd %s;put %s; quit' > /dev/null 2>&1", "lftp -u '%s,%s' ftp://%s -e 'set ssl:verify-certificate no;mkdir -p %s; cd %s;put %s; quit' > /dev/null 2>&1",
config.user, config.password, config.host, dir, dir, current_buffer_path config.user, config.password, config.host, dir, dir, current_buffer_path
) )
print("Generated command:", command)
vim.uv.spawn("sh", { vim.uv.spawn("sh", {
args = { "-c", command }, args = { "-c", command },
@@ -179,11 +176,14 @@ function M.UploadDir()
local remote = path_components(remotePath) local remote = path_components(remotePath)
local localDir = dirname(current_buffer_path) local localDir = dirname(current_buffer_path)
if localDir == directoryTemp then
localDir = "."
remote.parent = config.remote_path
end
local command = string.format( local command = string.format(
"lftp -u '%s,%s' ftp://%s -e 'set ssl:verify-certificate no;mkdir -p %q;cd %q;mirror -R %q; quit'", "lftp -u '%s,%s' ftp://%s -e 'set ssl:verify-certificate no;mkdir -p %q;cd %q;mirror -R %q; quit' >/dev/null 2>&1",
config.user, config.password, config.host, remote.parent, remote.parent, localDir config.user, config.password, config.host, remote.parent, remote.parent, localDir
) )
print("Generated command:", command)
vim.uv.spawn("sh", { vim.uv.spawn("sh", {
args = { "-c", command }, args = { "-c", command },