OrangeT / vim-csharp

Enhancement's to Vim's C-Sharp Functionality
117 stars 39 forks source link

msbuild.vim doesn't escape file names #42

Open coollambda opened 6 years ago

coollambda commented 6 years ago

So I opened up a Unity script in GVim 8.0 and got the following error

"Assets\Scripts\MapGenerator.cs" 156L, 3615C
Error detected while processing C:\Users\bulkycaf\.vim\plugged\vim-csharp\compiler\msbuild.vim:
line   33:
E518: Unknown option: Cave

which happens in the last line in the following code

execute 'CompilerSet makeprg=' . cs#get_net_compiler("msbuild") . "\\ " 
            \ . "/nologo\\ /clp:Verbosity=quiet\\ /property:GenerateFullPaths=true\\ "
            \ . s:build_file

so I echoed the s:build_file variable and it was .\Procedural Cave Generation - Tutorial.sln and so I fixed it by escaping the file name with fnameescape Vim function

execute 'CompilerSet makeprg=' . cs#get_net_compiler("msbuild") . "\\ " 
            \ . "/nologo\\ /clp:Verbosity=quiet\\ /property:GenerateFullPaths=true\\ "
            \ . fnameescape(s:build_file)

and now it works fine!

NgrNxk commented 4 years ago

+1 for inclusion in the repo! It helped me as well.