From 764649497637e50b4c8a7ed7927ddb03bb575793 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sun, 28 Nov 2021 12:32:20 +0100 Subject: Find config file in default location as fallback --- lua/rclone.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lua/rclone.lua b/lua/rclone.lua index 3685222..4403fee 100644 --- a/lua/rclone.lua +++ b/lua/rclone.lua @@ -27,7 +27,17 @@ local function find_config_file() --if current_dir:is_root() then if current_dir.filename == '/' then - return '' + -- set to 'rclone config file' output + local handle = io.popen('rclone config file', 'r') + handle:read() -- advance one line because we want the second line only + local output = handle:read(); + handle:close() + + config_file = output + local config_file_path = Path:new(config_file) + config_dir = config_file_path:parent().filename + + return config_file end current_dir = current_dir:parent() -- cgit v1.2.3