Re: How check for "path/file exists"?
- Posted by Kat <gertie at PELL.NET> Sep 03, 2000
- 471 views
On 3 Sep 2000, at 19:13, Dan B Moyer wrote: > Wolf, all, > > How can I check for whether a specified "path/file" exists?? > > I'm trying to use Wolf's "jumpto" (or perhaps his "ShellExecute2") to run > another program from within my program (to jump to it); when this is a > program with a "stable" path, no problem. But I'm wanting to be able to > jump to Wolf's tutorial, which isn't always at a known place in the Euphoria > folder, so I need to be able to *test* for whether the path/file I > tentatively specify actually exists or not, so I can activate the "open > file" dialog if it doesn't. > > I changed Wolf's "jumpto" to a function, thinking to use the return as a > test, but while it worked if the path was correct, when the path/file wasn't > correct it just bombed & output an error message about "can't open file". > > Any thoughts? Try opening the file for a read before you try to exec it. If it cannot be opened, then it's not there or it's locked,, either way, you can't run it. Kat