Fix cache directory creation

Revert some changes in 6fe1e50. Refs #109.
This commit is contained in:
Kien N 2012-01-22 19:52:11 +07:00
parent 6fe1e509c2
commit 17772fa8d8
3 changed files with 14 additions and 15 deletions

View File

@ -807,7 +807,7 @@ fu! s:CreateNewFile(...) "{{{1
let str = fnamemodify(pah.s:lash(pah).str, ':.')
en
en
if len(arr) | if isdirectory(ctrlp#utils#createpath(arr))
if len(arr) | if isdirectory(s:createpath(arr))
let optyp = str | en | el | let optyp = fname
en
if !exists('optyp') | retu | en
@ -1031,6 +1031,14 @@ fu! s:ispathitem()
\ || ( s:itemtype > 2 && g:ctrlp_ext_vars[ext]['type'] == 'path' )
endf
fu! s:createpath(arr)
for each in a:arr
let curr = exists('curr') ? curr.s:lash(curr).each : each
cal ctrlp#utils#mkdir(curr)
endfo
retu curr
endf
fu! ctrlp#dirnfile(entries)
let [items, cwd] = [[[], []], getcwd().s:lash()]
for each in a:entries

View File

@ -15,10 +15,7 @@ fu! s:lash(...)
endf
fu! ctrlp#utils#opts()
let usrhome = $HOME.s:lash($HOME)
let cahome = usrhome.'.cache'
let s:cache_dir = isdirectory(usrhome.'.ctrlp_cache')
\ ? usrhome.'.ctrlp_cache' : cahome.s:lash(cahome).'ctrlp'
let s:cache_dir = $HOME.s:lash($HOME).'.ctrlp_cache'
if exists('g:ctrlp_cache_dir')
let s:cache_dir = expand(g:ctrlp_cache_dir, 1)
if isdirectory(s:cache_dir.s:lash(s:cache_dir).'.ctrlp_cache')
@ -56,16 +53,10 @@ fu! ctrlp#utils#mkdir(dir)
en
endf
fu! ctrlp#utils#createpath(arr)
for each in a:arr
let curr = exists('curr') ? curr.s:lash(curr).each : each
cal ctrlp#utils#mkdir(curr)
endfo
retu curr
endf
fu! ctrlp#utils#writecache(lines, ...)
if isdirectory(ctrlp#utils#createpath(split(a:0 ? a:1 : s:cache_dir, '[\/]')))
let cache_dir = exists('a:1') ? a:1 : s:cache_dir
cal ctrlp#utils#mkdir(cache_dir)
if isdirectory(cache_dir)
sil! cal writefile(a:lines, exists('a:2') ? a:2 : ctrlp#utils#cachefile())
if !exists('a:1')
let g:ctrlp_newcache = 0

View File

@ -123,7 +123,7 @@ upon exiting Vim: >
*'g:ctrlp_cache_dir'*
Set the directory to store the cache files: >
let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp'
let g:ctrlp_cache_dir = $HOME.'/.ctrlp_cache'
<
*'g:ctrlp_prompt_mappings'*