Mercurial > vim-unreal
comparison autoload/unreal.vim @ 8:5cd58b3fd93d
Clean-up project name before setting it, and do proper error reporting.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 26 Jan 2021 12:00:31 -0800 |
parents | 59d75d8c254f |
children | b5040cfea052 |
comparison
equal
deleted
inserted
replaced
7:59d75d8c254f | 8:5cd58b3fd93d |
---|---|
204 call unreal#set_project(l:proj) | 204 call unreal#set_project(l:proj) |
205 endif | 205 endif |
206 endfunction | 206 endfunction |
207 | 207 |
208 function! unreal#set_project(projname) abort | 208 function! unreal#set_project(projname) abort |
209 let g:unreal_project = a:projname | 209 let l:clean_projname = trim(a:projname) |
210 if !has_key(g:unreal_branch_projects, l:clean_projname) | |
211 call unreal#throw("No project '".l:clean_projname."' in the current branch. Branch projects are: ".string(keys(g:unreal_branch_projects))) | |
212 endif | |
213 | |
214 let g:unreal_project = l:clean_projname | |
210 | 215 |
211 let l:cached_proj_file = unreal#get_cache_path("LastProject.txt", 1) " Auto-create cache dir. | 216 let l:cached_proj_file = unreal#get_cache_path("LastProject.txt", 1) " Auto-create cache dir. |
212 call writefile([a:projname], l:cached_proj_file) | 217 call writefile([l:clean_projname], l:cached_proj_file) |
213 | 218 |
214 call unreal#trace("Set UE project: ".a:projname) | 219 call unreal#trace("Set UE project: ".l:clean_projname) |
215 endfunction | 220 endfunction |
216 | 221 |
217 function! unreal#get_branch_projects(branch_dir) | 222 function! unreal#get_branch_projects(branch_dir) |
218 if empty(a:branch_dir) | 223 if empty(a:branch_dir) |
219 return {} | 224 return {} |