Uses app path instead of curr path for file.open
Posted: Mon Jul 23, 2012 4:35 pm
Running FNXBasic 2.1 apr_2012 and compiling for XP x86 & Win7 x64 - symptom is on both. I admit I`ve only had FNXB a few days since I switched from QB64 (didn`t like the HUGE set of runtime DLLs). I also admit I`m using it for CLI apps, and yea its really suited for Visual-type apps, but I just love that it bundles everything into 1 EXE.
Looks like FNXBasic file.open (filestream) always writes to the original app path (i.e. where the app resides) when read/writing files.
My text manipulating app is located in C:UTILS (included in Windows path).
I tried to force it to write to current path with these tests (both were unsuccessful).....
file.open("."+cmdofile$)
and
file.open("%cd%"+cmdofile$)
When I "CD " (C:) and run against a text file in C:, an interesting thing happened for the 2nd test:
>>Runtime error: Cannot create file "C:UTILS\%cd%list.txt"
(this is how I know its forcing the app path)
Any ideas? I cannot use the APPNAME$ FN because that returns exactly the above, is there something like a CURRPATH$ FN that I don`t know about? Basically, if I am in C: I want file.open to write in C:, if I am in C:My Documents, I want that directory, etc. etc.
Thanks in advance!
Looks like FNXBasic file.open (filestream) always writes to the original app path (i.e. where the app resides) when read/writing files.
My text manipulating app is located in C:UTILS (included in Windows path).
I tried to force it to write to current path with these tests (both were unsuccessful).....
file.open("."+cmdofile$)
and
file.open("%cd%"+cmdofile$)
When I "CD " (C:) and run against a text file in C:, an interesting thing happened for the 2nd test:
>>Runtime error: Cannot create file "C:UTILS\%cd%list.txt"
(this is how I know its forcing the app path)
Any ideas? I cannot use the APPNAME$ FN because that returns exactly the above, is there something like a CURRPATH$ FN that I don`t know about? Basically, if I am in C: I want file.open to write in C:, if I am in C:My Documents, I want that directory, etc. etc.
Thanks in advance!