File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -3,18 +3,23 @@ local utils = require('orgmode.utils')
33local M = {}
44
55--- @param path_str string
6+ --- @param base ? string
67--- @return string | false
7- function M .substitute_path (path_str )
8+ function M .substitute_path (path_str , base )
89 if path_str :match (' ^/' ) then
910 return path_str
1011 elseif path_str :match (' ^~/' ) then
1112 local home_path = os.getenv (' HOME' )
1213 return home_path and path_str :gsub (' ^~' , home_path ) or false
1314 elseif path_str :match (' ^%./' ) then
14- local base = vim .fn .fnamemodify (utils .current_file_path (), ' :p:h' )
15+ if not base then
16+ base = vim .fn .fnamemodify (utils .current_file_path (), ' :p:h' )
17+ end
1518 return base .. ' /' .. path_str :gsub (' ^%./' , ' ' )
1619 elseif path_str :match (' ^%.%./' ) then
17- local base = vim .fn .fnamemodify (utils .current_file_path (), ' :p:h' )
20+ if not base then
21+ base = vim .fn .fnamemodify (utils .current_file_path (), ' :p:h' )
22+ end
1823 return base .. ' /' .. path_str
1924 end
2025 return false
You can’t perform that action at this time.
0 commit comments