Wednesday, March 6, 2013

Re: problems setting up makeprg and makeef

On Wednesday, March 6, 2013 4:13:28 PM UTC-5, Gary Johnson wrote:
> On 2013-03-06, FlashBurn wrote:
>
> > I have setup a vim script to do the following
>
> >
>
> > " Setup the project home directory.
>
> > let s:project_path = 'C:\Documents and Settings\user\Projects\myproject\trunk'
>
> >
>
> > " Setup the project home directory such that Vim can understand it. It will
>
> > " escape white spaces.
>
> > let s:vim_project_path = fnameescape(s:project_path)
>
> > " cd to the project directory.
>
> > set cd=s:vim_project_path
>
>
>
> This is not doing what you think it's doing.
>
>
>
> 'cd' is an abbreviation for 'cdpath'. You are setting the value of
>
> the 'cdpath' option, not changing directory.
>
>
>
> Even if setting the value of 'cd' to the desired path was the right
>
> thing to do, your command won't do that because the :set command
>
> does not take variable names.
>
>
>
> The right command to use is this:
>
>
>
> :exe 'cd' s:vim_project_path
>
>
>
> The :exe command expands its arguments, then executes the result.
>
> See
>
>
>
> :help :exe
>
> :help :cd
>
>
>
> > " Setup make command such that shell can understand it.
>
> > " Path to make.exe.
>
> > let &makeprg = shellescape(s:project_path.'\tools\make.exe')
>
> > " Use makefile from 'src\makefile'.
>
> > let &makeprg .= ' -f '.shellescape(s:project_path.'\src\makefile')
>
> > " Change to a directory 'src' before running make.
>
> > let &makeprg .= ' --directory '.shellescape(s:project_path.'\src')
>
> >
>
> > " Setup the file where the output of ':make' will be redirected.
>
> > let &makeef = shellescape(s:project_path.'\src\error.err')
>
> >
>
> > But for some reason whenever I run :make, I'm getting the following error
>
> >
>
> > E40: Can't open errofile :C:/Documents and Settings/user/Projects/myproject/trunk/src/error.err"
>
> >
>
> > I looked at help for E40 but nothing really can explain why this is happening.
>
> >
>
> > Now if my makeef is setup as follows
>
> > let &makeef = ""
>
> >
>
> > Then Windows redirects the output to a temporary file and there
>
> > are no issues. I'd like to be able to store the output in a given
>
> > file not in a temporary file.
>
> >
>
> > Does anybody know what is the issue and how it can be fixed?
>
> >
>
> > Any help is appreciated.
>
>
>
> I don't use Windows very much. What you've shown looks good to me.
>
>
>
> The contents of the E40 message suggests that the file name was
>
> built correctly. Are you sure you have write permission in that
>
> directory? (I wonder if that message means the file cannot be
>
> opened for writing or cannot be opened for reading, e.g., doesn't
>
> exist.)
>
>
>
> Regards,
>
> Gary

I think I know where the problem is.
It is the spaces in the path. The error.err file is created. But when vim tries to open there it sees spaces in it, that's why it can't open it. The solution, I decided to use is the 8dot3 path. Thanks for the help everyone.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: