On Wed, 2006-05-24 at 12:04 -0400, Charles E Campbell Jr wrote:
> A.J.Mechelynck wrote:
> > Charles E Campbell Jr wrote:
> > >
> > > I've had several folks having a problem with WinXP and netrw.
> > > The problems seem to involve temporary files during attempts to
> > > use ftp; since temporary filenames are produced by tempname(),
> > > they're o/s dependent.
> >
[snip]
> > Sorry, Dr. Chip, I can't help you there so I'm referring you to
> > the vim-dev list:

I might be completely off the trail here, but this sounds suspiciously
like my age old problem of using Vim-generated paths for Windows calls
via system(), tempname() or the like. 

No matter how hard I've tried to maintain a Windows path in a var, it
somehow always ends up with an escaped space or a forward slash. (It
seems use of fnamemodify() or expand() resets them.) So a long time
ago I gave up trying to keep slashes and backslashes straight in my
variables in favor of a wrapper approach:

    let tmp = myvar
    " system call prep
    if has("win32")
        " remove trailing slash (Win95)
        let tmp = substitute(tmp, '\(\\\|/\)$', '', 'g')
        " remove escaped spaces
        let tmp = substitute(tmp, '\ ', ' ', 'g')
        " convert slashes to backslashes
        let tmp = substitute(tmp, '/', '\', 'g')
    endif
    set noshellslash
    call system("mkdir " . '"' . tmp . '"')
    set shellslash

Just assume all paths are Windows-hostile unless passed through such a
wrapper. (I never see these errors on *nix, so I assume it's path
related.)

Unfortunately, it is difficult to make such a strategy reasonably
modular since you want to maintain the space between the command,
options and the final path-filename argument. Abstracting the path
through one more function ends up confusing me more than just
duplicating the wrapper where needed.

You guys are both old pros, but I've been bushwhacked by this one so
many times I figured I'd encourage you to take one more gander.


-- 
Steve Hall  [ digitect mindspring com ]
:: Cream... something good to put in your Vim!
::   http://cream.sourceforge.net

Reply via email to