103 unless $curbuf->Name; |
103 unless $curbuf->Name; |
104 END_PERL |
104 END_PERL |
105 endfunc |
105 endfunc |
106 endif |
106 endif |
107 |
107 |
108 func! vimrc#PrepDir(path, prune_days) abort |
108 func! vimrc#PrepDir(path) abort |
109 if !filewritable(path) |
109 if !filewritable(a:path) |
110 call mkdir(path, 'p', 0700) |
110 call mkdir(a:path, 'p', 0700) |
111 endif |
111 endif |
112 endfunc |
112 endfunc |
113 |
113 |
114 func! vimrc#PruneFiles(path, days) abort |
114 func! vimrc#PruneFiles(path, days) abort |
115 let l:path = expand(a:path) |
115 let l:path = expand(a:path) |
116 if isdirectory(l:path) |
116 if isdirectory(l:path) |
117 for file in split(globpath(l:path, "*"), "\n") |
117 for file in split(globpath(l:path, "*"), "\n") |
118 if localtime() > getftime(file) + 86400 * a:days |
118 if localtime() > getftime(file) + 86400 * a:days |
119 delete(file) != 0 |
119 call delete(file) |
120 endif |
120 endif |
121 endfor |
121 endfor |
122 else |
122 endif |
123 endfunc |
123 endfunc |