diff --git a/lua/nvim-sync-ftp/cli.lua b/lua/nvim-sync-ftp/cli.lua index 8cfc7cc..e6e3f43 100644 --- a/lua/nvim-sync-ftp/cli.lua +++ b/lua/nvim-sync-ftp/cli.lua @@ -134,14 +134,11 @@ function M.UploadFile() local remotePath = config.remote_path .. relative_path - print("remotePath:", remotePath) - print("current_buffer_path:", current_buffer_path) local dir = dirname(remotePath) 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", config.user, config.password, config.host, dir, dir, current_buffer_path ) - print("Generated command:", command) vim.uv.spawn("sh", { args = { "-c", command }, @@ -179,11 +176,14 @@ function M.UploadDir() local remote = path_components(remotePath) local localDir = dirname(current_buffer_path) + if localDir == directoryTemp then + localDir = "." + remote.parent = config.remote_path + end 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 ) - print("Generated command:", command) vim.uv.spawn("sh", { args = { "-c", command },