Re: Opening a file - File Open Dialog spoils future code

new topic     » goto parent     » topic index » view thread      » older message » newer message

Mike777 wrote:
> 
> Thanks to all.  I *knew* it was something simple that I just wasn't seeing.
>  Fully specifying the path for the file was an easy fix.
> 
A bit late now then, but for future reference I was about to suggest this:
sequence saveDir
saveDir=current_dir()
fName = getOpenFileName(...)
if not chdir(saveDir) then ?9/0 end if


I guess (random thought of the day) that if win32lib wanted to do this it ought
to have a flag and a saved dir of it's own, maybe:
integer goDirValid  goDirValid=0
sequence goDir

function getOpenFileName(..,fName,..)
sequence sDir
  sDir=current_dir() -- so that open("xxx.config") is unaffected by this
  if goDirValid      -- so that next getOpenFileName starts where expected
  and length(fName)=0 then -- goDir would have no effect in this case
      if not chdir(goDir) then ?9/0 end if
  end if
  ...
  goDir=current_dir()
  goDirValid=1
  if not chdir(sDir) then ?9/0 end if
  return result
end function


Then again, this might cause all kinds of subtle incompatibility problems...

Regards,
Pete

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu