RunProgram("")
RunProgram("")
Do you think RunProgram("") is an error? What if the file is deleted? This is also not the correct path to the file, why is it better than an empty line? My variable turned out to be empty and the code generated an error (discovered on Linux).
Re: RunProgram("")
Code: Select all
RunProgram(PathConfig$ + "AdvancedSearch.chm")Example number two:
I read the path editor=path from the ini file and get an empty string due to the fact that an empty value is valid for the ini file.
Reading the way
Code: Select all
Global editor$ = "xdg-open"
editor$ = ReadPreferenceString("editor", editor$)
RunProgram(editor$, ......Code: Select all
If Not Asc(editor$)
editor$ = "xdg-open"
EndIfI don't think that RunProgram() will be executed in a high-speed loop and run the executable file 100 times per second, so checking for an empty string can be done.
Re: RunProgram("")
Oh, you meant if the user deletes the file, and not deleted with RunProgram() itself (with "del" or something). I see.
But, it's still no problem because you're checking the return value of RunProgram(), right?
But, it's still no problem because you're checking the return value of RunProgram(), right?
Code: Select all
Debug RunProgram(PathConfig$ + "NoSuchFile") ; Returns 0 (meaning failed).Re: RunProgram("")
Code: Select all
editor$ = ""
RunProgram(editor$, ......If the path is incorrect, the debugger skips this line.
Re: RunProgram("")
Hmm, good catch. This returns 1 (success) and opens Explorer.exe for me:
Code: Select all
DisableDebugger
editor$=""
MessageRequester("Result",Str(RunProgram(editor$)))
