Skip to content
This repository has been archived by the owner on May 29, 2023. It is now read-only.

Fail to create session storage directory on MS Windows (bugfix provided) #30

Open
iiifr opened this issue Aug 31, 2019 · 0 comments
Open

Comments

@iiifr
Copy link

iiifr commented Aug 31, 2019

I set my own g:workspace_session_directory in _vimrc , when vim-workspace creates a new session, it fail to create the session storage folder whose name contains opened project path. I looked into code of vim-workspace and figured out this problem is caused by not replacing character : and \ properly in Windows-style path. I modified the function GetSessionDirectoryPath() in plugin/workspace.vim and it's worked.

Modified GetSessionDirectoryPath():

function! s:GetSessionDirectoryPath()
  if !isdirectory(g:workspace_session_directory)
    call mkdir(g:workspace_session_directory)
  endif
  let l:cwd = getcwd()
  if has('win32')
    let l:fileName = substitute(l:cwd, '\', '%', 'g')
    let l:fileName = substitute(l:fileName, ':', '%', 'g')
  else
    let l:fileName = substitute(l:cwd, '/', '%', 'g')
  endif
  let l:fullPath = g:workspace_session_directory . l:fileName
  return l:fullPath
endfunction
@iiifr iiifr changed the title Fail to create session storage directory on MS Windows Fail to create session storage directory on MS Windows (bugfix provided) Aug 31, 2019
hutterm added a commit to hutterm/vim-workspace that referenced this issue Jun 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant