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)
243243 local parts = vim .split (archive_loc , ' ::' )
244244 local archive_location = vim .trim (parts [1 ])
245245 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 )
247250 end
248251 return vim .fn .fnamemodify (archive_location , ' :p' )
249252end
Original file line number Diff line number Diff line change @@ -38,6 +38,10 @@ function OrgMappings:archive()
3838 file = Files .get_current_file ()
3939 item = file :get_closest_headline ()
4040 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
4145 self .capture :refile_file_headline_to_archive (file , item , archive_location )
4246 Files .reload (
4347 archive_location ,
You can’t perform that action at this time.
0 commit comments