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

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

Matt Lewis wrote:
> 
> CChris wrote:
> > 
> > I am only saying two things:
> > 1/ since ex.err may land in folders from where no Eu rogram was ever run,
> > other processes must interfere in some cases (in case of a crash? I don't
> > know);
> > 2/ since use of the current directory is so confusing for practical use
> > under Windows, and since there is such an excessive concern about avoiding
> > confuion in the language, I think relying on what the "current directory"
> > happens to be in an only mildly deterministic way (from the user standpoint)
> > should be actively discouraged in some way.
> 
> OK, I definitely think we need to investigate this some more, including to
> find a repeatable way to mess up the current dir so that it does not 
> behave in the obvious way.  I'm not convinced yet that there is strange
> behavior, though I wouldn't be terribly surprised if there were some 
> difference based on using the c-library routine vs the Win32 routine.
> That should be fairly easy to test.  There may be other ways to change 
> the current dir, such as opening a file (at least from the c-library's 
> perspective--again, some testing is required).
>  
> > To reply to Pete's post: I don't think this would be win32lib's job. The
> > interpreter should lock the "current directory" for exw[c].exe to be the
> > one where the file which is being run lies, and nullify any change not
> > deliberately made by the .exw being run. Otherwise, users should be
> > specifically advised about the seemingly random changes it may undergo
> > and their consequences.
> 
> I think that if a library does something that may interfere with the user
> (such as calling chdir) then the library should either attempt to restore
> whatever it changed, or at least document when something like that changes,
> so that users will be able to understand that they might need to check
> for it.
> 
> Matt

This is fine as long as the interference an included file causes. But obviously
there are other cases, and the lock would apply only to these. As I said, I found
a couple ex.err files in places that had never seen an Eu program. If one was
ever launched by the Run... menu while this directory was displayed by Explorer,
then the interpreter should correct this setting which hardly relates to the
user's intent - but thats only an hypothesis.

By the way, the C library doesn't open files by sheer magic; chances are that it
uses the Windows API too, but in ways that may not be documented by the compiler,
and might differ across compilers.

CChris

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

Search



Quick Links

User menu

Not signed in.

Misc Menu