diff options
author | Daniel Weipert <code@drogueronin.de> | 2021-11-28 12:32:20 +0100 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2022-01-10 13:28:28 +0100 |
commit | 764649497637e50b4c8a7ed7927ddb03bb575793 (patch) | |
tree | f113376bc22edba807d3b4e10ddd54c54a350e26 | |
parent | 20c63c36b57f652d38c67666adf764dc37920056 (diff) |
Find config file in default location as fallback
-rw-r--r-- | lua/rclone.lua | 12 |
1 files changed, 11 insertions, 1 deletions
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() |