Hi

Am 09.08.2006 14:08:04 schrieb Yakov Lerner:

> Looks like an input() bug to me.

To me it looks even more strange. I've tested a bit more.

:echo filereadable("G:\Projekte\CS Simple\run.pyw")
:echo filereadable("G:\Projekte\CS\ Simple\run.pyw")
returns 0

:echo filereadable("G:\\Projekte\\CS Simple\\run.pyw")
:echo filereadable("G:\\Projekte\\CS\ Simple\\run.pyw")
:echo filereadable("G:/Projekte/CS Simple/run.pyw")
returns 1

In my script versions 1, 3 and 5 work. So there filereadable has a
problem with the quoted space. And in command mode the unqouted
backslash is the problem.


Here is the function from my script:
---snip---
function! s:SetMainScript()
  if s:mainfile == ""
    let fnInput = expand('%:p')
  else
    let fnInput = s:mainfile
  endif
  call inputsave()
  let fn = input('Mainfile: ', fnInput, 'file')
  call inputrestore()
  " input precedes <space> with \, but filereadable does not like that
  " let fn = substitute(fn, "\\\\ ", " ", "g")
  if filereadable(fn) == 1
    let s:mainfile = fn
    let s:ExeDir = fnamemodify(fn, ':p:h')
    echo s:mainfile . ' set as the starting program.'
  else
    echoerr fn . ' is not readable'
  endif
endfunction
---snap---


cu boesi
-- 

...schlafen ist sowieso ungesund...
           .-==Police Academy I==-.

Reply via email to