File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -243,7 +243,10 @@ function Config:parse_archive_location(file, archive_loc)
243
243
local parts = vim .split (archive_loc , ' ::' )
244
244
local archive_location = vim .trim (parts [1 ])
245
245
if archive_location :find (' %%s' ) then
246
- return string.format (archive_location , file )
246
+ local file_path = vim .fn .fnamemodify (file , ' :p:h' )
247
+ local file_name = vim .fn .fnamemodify (file , ' :t' )
248
+ local archive_filename = string.format (archive_location , file_name )
249
+ return string.format (' %s/%s' , file_path , archive_filename )
247
250
end
248
251
return vim .fn .fnamemodify (archive_location , ' :p' )
249
252
end
Original file line number Diff line number Diff line change @@ -38,6 +38,10 @@ function OrgMappings:archive()
38
38
file = Files .get_current_file ()
39
39
item = file :get_closest_headline ()
40
40
local archive_location = file :get_archive_file_location ()
41
+ local archive_directory = vim .fn .fnamemodify (archive_location , ' :p:h' )
42
+ if vim .fn .isdirectory (archive_directory ) == 0 then
43
+ vim .fn .mkdir (archive_directory , ' p' )
44
+ end
41
45
self .capture :refile_file_headline_to_archive (file , item , archive_location )
42
46
Files .reload (
43
47
archive_location ,
You can’t perform that action at this time.
0 commit comments