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')
3
3
local M = {}
4
4
5
5
--- @param path_str string
6
+ --- @param base ? string
6
7
--- @return string | false
7
- function M .substitute_path (path_str )
8
+ function M .substitute_path (path_str , base )
8
9
if path_str :match (' ^/' ) then
9
10
return path_str
10
11
elseif path_str :match (' ^~/' ) then
11
12
local home_path = os.getenv (' HOME' )
12
13
return home_path and path_str :gsub (' ^~' , home_path ) or false
13
14
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
15
18
return base .. ' /' .. path_str :gsub (' ^%./' , ' ' )
16
19
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
18
23
return base .. ' /' .. path_str
19
24
end
20
25
return false
You can’t perform that action at this time.
0 commit comments