shellExecute PATH malfunction
- Posted by Antonio Alessi <a.admin at myway.it> Jun 08, 2004
- 445 views
I met a problem that could be considered a (serious) bug: if a [main] program calls another program that is in the same directory (suppose it is C:\EUPHORIA\MYPROGRAM), as:
shellExecute( "open", ProgramDir&"\\about.exw", SW_NORMAL)
then two cases become possible: 1. the 1st program is working on that folder, so the 2nd program behaves normally, that is it can normally load bitmaps from a "BITMAP\" subdirectory folder. 2. the 1st (calling) program has already worked on another subfolder, like "DATA\"; in this case the 2nd program resolves from there the "ProgramDir = current_dir()" path load, instead of checking its own true current_dir(), that is always the "C:\\EUPHORIA\\MYPROGRAM", even if this "DATA\" path is casual and has nothing to do with that call, that may be activated in many different and independent circumstances. Besides, the program is not chained, as it was possible in QBasic, sharing any data with the 1st. For that it is no more able to load bitmaps from the "BITMAP\" folder, even if the internal instruction should be absolute, like:
ProgramDir = current_dir() setBitmap( faqs_button, ProgramDir&"\\bitmap\\faqs-but.bmp")
because it concatenates the two paths like this:
"C:\\EUPHORIA\\MYPROGRAM\\data\\bitmap\\faqs-but.bmp"
giving a Win32lib Error Warning. However I don't think it deals with a Win32lib problem, but rather EU. Is this a correct result? How to outflank this obstacle, since the program may be installed everywhere by the user, and the about button may be pressed at any time? Thank you. Antonio Alessi