diff options
Diffstat (limited to 'lua/conform/fs.lua')
-rw-r--r-- | lua/conform/fs.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lua/conform/fs.lua b/lua/conform/fs.lua index 6f92e18..187bd7c 100644 --- a/lua/conform/fs.lua +++ b/lua/conform/fs.lua @@ -73,7 +73,15 @@ M.relative_path = function(source, target) while not M.is_subpath(source, target) do table.insert(path, "..") local new_source = vim.fs.dirname(source) - assert(source ~= new_source) + + -- If source is a root directory, we can't go up further so there is no relative path to the + -- target. This should only happen on Windows, which prohibits relative paths between drives. + if source == new_source then + local log = require("conform.log") + log.warn("Could not find relative path from %s to %s", source, target) + return target + end + source = new_source end |