# HG changeset patch # User Ludovic Chabant # Date 1611691231 28800 # Node ID 5cd58b3fd93d1288fb6ab9997adc0e2993c4ce58 # Parent 59d75d8c254f7e8352c257eda1f560ad225b8fb0 Clean-up project name before setting it, and do proper error reporting. diff -r 59d75d8c254f -r 5cd58b3fd93d autoload/unreal.vim --- a/autoload/unreal.vim Tue Jan 26 11:59:58 2021 -0800 +++ b/autoload/unreal.vim Tue Jan 26 12:00:31 2021 -0800 @@ -206,12 +206,17 @@ endfunction function! unreal#set_project(projname) abort - let g:unreal_project = a:projname + let l:clean_projname = trim(a:projname) + if !has_key(g:unreal_branch_projects, l:clean_projname) + call unreal#throw("No project '".l:clean_projname."' in the current branch. Branch projects are: ".string(keys(g:unreal_branch_projects))) + endif + + let g:unreal_project = l:clean_projname let l:cached_proj_file = unreal#get_cache_path("LastProject.txt", 1) " Auto-create cache dir. - call writefile([a:projname], l:cached_proj_file) + call writefile([l:clean_projname], l:cached_proj_file) - call unreal#trace("Set UE project: ".a:projname) + call unreal#trace("Set UE project: ".l:clean_projname) endfunction function! unreal#get_branch_projects(branch_dir)