Address Bar Text Help

Blitz3D Forums/Blitz3D Beginners Area/Address Bar Text Help

DheDarkhCustard(Posted 2008) [#1]
Hey fellows,

I am in the middle of creating a file browser (desktop, not internet) to read saved game files etc. But I can't figure out how to get the address bar to say the correct path after I press backspace (to go up a folder level, the "..") It just displays "C:\blah\..\..\.." adding dots when I press backspace.

Here is a working example section of the code:
;;
Global folder$="C:\Program Files\Blitz3D\Samples"
SetBuffer BackBuffer()
;; read the directory
.loaddir
sel=ReadDir(folder$)
;; load files
;
;;
;; draw the folders etc
Repeat
	Cls
	Text 0,0,folder$,0,0
	If KeyHit(14)				;[backspace]
		folder$=folder$+"\.."
		;Delete Each file
		Goto loaddir
	EndIf
	If KeyHit(1) End
	Flip
Forever


It doesn't load any files or anything, just displays the path.

The only way I thought to fix this was to create a formula to count the \ slashes and find out the last one and then trim off the rest of the text, but there must be an easier way right?

right?


xtremegamr(Posted 2008) [#2]
You don't really have to make a formula or anything; I'm pretty sure this works:



Basically, instead of using a variable for the folder, use CurrentDir() and ChangeDir().


DheDarkhCustard(Posted 2008) [#3]
Hey thanks for your reply xtremegamr

The above code you supplied works when you add a "folder=currentdir()" after the changedir you added. So like this:



I am not majorly happy. Thanks a bunch.