Well behaved Windows?

Blitz3D Forums/Blitz3D Programming/Well behaved Windows?

big10p(Posted 2005) [#1]
I don't know jack about the internal workings of Windows, as I'm about to demonstrate with this question. :)

Say I have my B3D app running alongside one or more other apps. If my app changes to a specific directory to read files, and then one of the other apps gets focus which changes the current directory to something else. When my app gets focus again, will the current directory automatically be set back to what it was before losing focus, or do I have to cater for this?

I would normally try to use full path specs when accessing files, but I have a situation where doing this isn't desirable - from a coding perspective. :P

Thanks in advance to any Windows bod who can clue me in.


erbbysam(Posted 2005) [#2]
my personal opinion... Biltz3d creates processor level apps with no way to bottle down the speed without throwing in a Delay 10 in a main loop... It's really made for games and when your playing games you should have no need to go to other windows... If you really want to plan for the unlikly then before you load a file, check the directory


KuRiX(Posted 2005) [#3]
For what i know, every app has its own "actual directory"...


big10p(Posted 2005) [#4]
If you really want to plan for the unlikly then before you load a file, check the directory

Unfortunately, it's not going to be that simple in my case. I'm not just reading a file at one point in my code - I have many file access functions. Littering the code with ChangeDir current_dir$ everytime I want to access a specific file/directory isn't going to be prettty. :)

KuRix: I hope you're right. It would make sense. I might do some testing tomorrow, just to make sure.

Cheers.


Braincell(Posted 2005) [#5]
If a file is being accessed by another app, and you try access it or do something with it, it will block you. If you have a path to a file, and the path changes, you will obviously need the new path and theres nothing you can do about this. if you are only talking about using the changedir command, i dont see how another app could change the directory your app is refering to inside your own program. The command changedir you use in b3d is independent of other apps. If you were referring to other modules/functions within your code, then changedir in another function will influence the current directory youre viewing throughout the program. "actual directory" is also termed as, i think, the directory you start in.


John Blackledge(Posted 2005) [#6]
AFAIK, 'currentdir' or its equivalent has been local to each app since about Win95.

So the fact that another app refers to '..' or '\' should not make any difference to yours.

Having said that, just to be safe when my app starts I get CurrentDir and save it, then base all my file paths on that throughout the progress of the app.

This will also obviously work when you sell an app - the app will (in its first line) get the user's drive and path as currentdir, then base every future path on that.


big10p(Posted 2005) [#7]
if you are only talking about using the changedir command, i dont see how another app could change the directory your app is refering to inside your own program.

That's the thing - I'm old enough to hark back to the days of MSDOS where changing the current directory meant that subsequent file specs where relative to it. :)

AFAIK, 'currentdir' or its equivalent has been local to each app since about Win95.

Yeah, I did some testing today and that does seem to be the case - thank God. :)

Cheers.