Changing directories

BlitzPlus Forums/BlitzPlus Beginners Area/Changing directories

PaulJG(Posted 2005) [#1]
I'm having alittle problem getting this to work, using the example:

; ChangeDir example

ChangeDir "c:winntsystem32"
Print "The folder has been changed to: " + currentdir$()

It doesnt work !!

Also the text says "directory/path = full path to directory/folder"

does that mean you put the name of the folder, then the path ?? ie.. program files/c:

So.. how do I change the directory from where ever it currently is to "C:\program files".

And, for some reason - this doesnt work:

a$=CurrentDir$
a=Len(a$)

It reports back with a length of '0' ???

Please Help !!!


CS_TBL(Posted 2005) [#2]

a$=CurrentDir$
a=Len(a$)



try brackets.. CurrentDir$()

iirc there's a bug in CurrentDir$(). Dunno why it hasn't been fixed yet..

When I run my apps in the IDE, then the command seems to work fine, but when I make an .exe of the same file, then it could be that I end-up in C:\My Documents\ for some odd reason..


Beaker(Posted 2005) [#3]
CurrentDir() works fine here. You should always run it at the program start and store the result (if you want to keep a hold on the program directory).


CS_TBL(Posted 2005) [#4]
ah wait, I already know what the issue was:

ChangeDir CurrentDir$()

f$=RequestFile("bla")

End


When running this code in the IDE, it works.. it starts in the dir where I saved my sourcecode. But when I make an .exe of it, then the app's file requester always starts @ c:\My Documents, no matter where I run the .exe file.. so if CurrentDir$() doesn't fail, then does RequestFile have a bug? I assume it should request a file starting in the current dir ... at least that's what I think is logical..


Beaker(Posted 2005) [#5]
Try this:
currdir$ = CurrentDir$()
f$=RequestFile("Load file","*.*",0,currdir+"anyname.jpg")

CurrentDir() has no effect on the file requester, you use the final 4th parameter for this.


CS_TBL(Posted 2005) [#6]
with "starting in the current dir" I meant ofcourse after performing a ChangeDir command..

hm.. anyway, the currdir+"randomname.ext" is a bit ugly I think.. I just want to see nothing there, as if I was doing the file requester without that 4th param.
Funnily enough, when I just put there 'currdir$' without that extra filename, it doesn't perform a filerequester at all!

And besides, changedir and the normal file request *works* .. in the IDE.. it just doesn't work as .exe ... at least I call *that* a bug..