View Full Version : DIR_GetCurrent behaves different with a bundled EXE
Michael Hartlef
16-05-2008, 12:26
Hi folks,
I noticed that DIR_GetCurrent will return the main folder of the bundled EXE's drive instead of the folder of the EXE thta it return when you start a script from within thinAIR or by double clicking on it in the explorer.
Is this a behaviour by design?
Cheers
Michael
RobertoBianchi
16-05-2008, 13:08
Hi Michael,
sorry but I can't uderstand the issue.
I downloaded your test example but while running it all seem fine (please se the attached image picture).
The Bundle changes the working directory (aka the current directory for the bundle process) to the one that holds the executable.
May be that this is reflected in the next script execution.
I'm not sure, please let me to verify this assertion.
Bye,
Roberto
Petr Schreiber
16-05-2008, 14:36
Hi Mike,
do not use DIR_GetCurrent, go for APP_SOURCEPATH, it worked well for me in all possible and even impossible cases.
Petr
P.S. I think I just realised on what you work now. Wow.
Michael Hartlef
16-05-2008, 15:26
Damn, I swear to god, that it didn't work before. Now is does like I expect it to do. Sorry guys for the false alarm.
RobertoBianchi
16-05-2008, 16:01
Petr,
if also you discovered (in the past) that the DIR_GetCurrent() function had a wrong behaviour please let us know.
Thanks,
Roberto
Petr Schreiber
16-05-2008, 17:11
Hi Roberto,
I do not think DIR_GetCurrent works wrong, I just have no use for it ( similar to CURDIR$ in PB, am I right ?).
I thought what Mikes need might be provided by APP_SOURCEPATH.
Thanks,
Petr
RobertoBianchi
16-05-2008, 17:48
Yes similar, you are right.
Ciao,
Roberto
P.S. I think I just realised on what you work now. Wow.
Ok, got me curious and I ran the test program and if I think what it is also DOUBLE WOW!
Michael Hartlef
16-05-2008, 20:55
Yes, it is a little test for converting thinBasic scripts into PASCAL code. I will see how far I get. thinBasic is so powerful syntax and fucntion wise that it will be hard to cover all the nice tweaks that Eros has put into thinBasic.
RobertoBianchi
16-05-2008, 21:47
Hey Michael,
Rome was not built in a day isn't it? So please take your time.
Ciao,
Roberto
Not to get off subject, but I don't know if you guys had a chance to watch that .net video on 3dbuzz. They explain things that make .net pretty appealing.
Main things if you don't have time to watch the video.
.net allows:
Cross platform development
Cross language development both for physical devices and the internet
The IL has to meet a specification and if a part of it doesn't meet it, the code still runs, just the parts that don't meet specs give an error message.
A good example is that C# and C++ are case sensitive. The specification says things need to be case sensitive. But if you are in VisualBasic.net, case as in most basic's is not case sensitive. You can use any funtion in an executable or dll, but if there are 2 functions in c++, test and Test, these 2 are 2 different functions in c++, but to VB it is one..so if you try to call this from VB it won't know which to call and give an error message or warning, but the other functions that meet the specification are still usable.
Logan the main coder there is a big Delphi fan, I think he has mentioned it is his favorite language although he is a wizard of many languages.
Now there are over 20 languages that can run in .net, so it is pretty amazing when you see the problems Microsoft faced and how they solved them.
Anyways, Michaels port to Pascal is very important I think. I really do believe thinBasic will have to move away from powerbasic unless major changes are made to powerbasic. My opinion of course, but the future is portability and will just get more so with each passing year.
Mike, this is a very ambitious project but very worthwhile, even just to test out ideas and see where bottlenecks would be for possible future switch.
Good luck!
Michael Hartlef
17-05-2008, 10:09
Kent, when you say cross platform development, to you mean MONO? As I heard, it isn't 100% compatible. Well, imho if something isn't compatible it isn't much useful for cross platform development.
Why move away from powerbasic?
Mike, yes mono on linux, but also handheld os's that support .net and even the mac os.
There are 3 options, that I know of, there maybe more, and I would like to know about them-- if so?
Java
.Net and its forms like mono
and free pascal
I think any of the above or another unkown alternative offer a longer future and more adoption.
This is just my opinion of course.
I never thought Java would be as big as it got so my opinion is wrong many times, but I still have them :)
I also thought .net was lame, but now that I understand about what Microsoft faced and how it chose to solve the big problem, it is pretty impressive.
free pascal is neat and although pascal has been around a long time and has a very nice hard core base, I don't know if it will ever get the recognition it deserves.
ErosOlmi
19-05-2008, 10:36
I noticed that DIR_GetCurrent will return the main folder of the bundled EXE's drive instead of the folder of the EXE thta it return when you start a script from within thinAIR or by double clicking on it in the explorer.
Hi Michael.
Personally I've nevel loved DIR_GetCurrent or other similar functions because the current directory can be changed by hosting process (for example thinAir that execute a script) or child process (for example a shelled process executed by the script).
So my suggestion is to follow Petr indication and use the APP_... functions to return a full script path and possibly work with paths relative to the script position.
Instead, if you have some ideas about a more specific function that returns some other dir, let me know.
Ciao
Eros