Remembering previously used folder.

BlitzPlus Forums/BlitzPlus Programming/Remembering previously used folder.

Simon S(Posted 2003) [#1]
Is there a way to call a file requester that will either bring the last directory you were in, or start in the directory you send it?

It's hugely infuriating to deal with large number of files and having to navigate to the directory every time.


CS_TBL(Posted 2003) [#2]
err.. remember the path in a string, and use ChangeDir command before the filerequester?

ChangeDir "d:\Muppetshow\"
gonzo=RequestFile("load","*")

WaitKey()
End



Simon S(Posted 2003) [#3]
Nope, nothing happens when I do that. It's still obsessed with the root directory.


CS_TBL(Posted 2003) [#4]
that's odd!

Try this then.. here (v1.34) it works fine..

app=CreateWindow("dirtest",32,32,128,128)
button=CreateButton("RequestFile",16,8,96,24,app)
Repeat
	WaitEvent()
	If EventID()=$803 quit=True
	If EventID()=$401
		file$=RequestFile("load..")
		path$=cutfilename(file$)
		DebugLog path$
		ChangeDir path$
	EndIf
Until quit
End

Function cutfilename$(file$)
	For t=Len(file$) To 0 Step -1
		If Mid$(file$,t,1)="\" Exit
	Next
	Return Left$(file$,t)
End Function



by the way :)

For t=Len(file$) To 0 Step -1

should it go down to 0 or 1 ?


Simon S(Posted 2003) [#5]
Thanks for the code man, but still no luck.

I had already tested it to see if the dir was being set and Blitz as far as loading things by hand (ie LoadImage), it fine. But filerequest is still desperate to be in the root.

I was wondering if it's a windows thing, as I have a handful of non blitz applications that never remember the last used dir, but I assumed that was lazy coding as some do remember it.


CS_TBL(Posted 2003) [#6]
odd...! guess this is where my suggestions end.. what version of B+ do you use?


Simon S(Posted 2003) [#7]
1.35, I guess I could uninstall I try the previous release.


CS_TBL(Posted 2003) [#8]
I've bad news for ya... I installed 1.35 ..(I didn't yet because of the winning horse principle :) and the app I did works fine.

So, either 1 the gods don't like you, 2 there's something wrong with your system, or 3 you encountered a nice little bug in B+ !

.. anyone else here with suggestions?


okee(Posted 2003) [#9]
CS_TBL
Are you testing that with a compiled exe ?

okee


CS_TBL(Posted 2003) [#10]
Just tested that... works too.

On my system (athlon2ghz/256mb/98se/Blitsplus v1.34/v1.35), the app is fully functional..!


Snarty(Posted 2003) [#11]
It don't work on WinME either, even using a system ChangeDir is ignored. I've gone down the C route for all requesters anyhow, since you can load them, and retrieve what you want.


Simon S(Posted 2003) [#12]
No I don't think it's an ME thing, my flatmate (who is on the same network as me) has no problems with this and is running the same crappy OS.

I guess it's a windows thing, but google reveals nothing on the subject and a tech forum I frequent has nothing on it. Apparently I've discovered a unique bug so I'll go for CS_TBL's option 1, replacing the word God, with Microsoft.

Just "putting up with it" is not an acceptable solution for me, I'll guess I'll hack together a custom file requester.

DAMN YOU MICROSOFT, DAMN YOU TO HELL.


CS_TBL(Posted 2003) [#13]
yeah we're all very happy with M$ indeed :)

tho it's kinda radical, you might want to try a re-install of windows.. Maybe your current windows installation is too old and too messed-up :)

btw.. since I'm kinda lazy in reading manuals, it seems you can use the 'CurrentDir' command instead of my cutfilename(file$) function. (tho, writing such a function is always good exercise ofcourse)

Maybe it's a windows bug.. on the other hand, blitz+ is claimed to work on all windows platforms.. maybe it's something that *can* be fixed in B+ by bypassing the possible M$ bug .. dunno about that.


soja(Posted 2003) [#14]
How do you know it's a Windows bug? If it were, it seems one should be able to reproduce it on similar setups. Perhaps there are different settings that you're not thinking about.

Incidentally, it works fine on my XP system.


Simon S(Posted 2003) [#15]
I have run the same program on a different machine with the same OS. It worked fine on the other machine.

And it was the same version of B+ both times, so that makes windows a more likely culprit (same version blitz on both machines, and a lot more can be different about Windows)

Also there are a few non blitz programs on my machine that forget their directory (the ones that use the same style of requester as Blitz, oddly enough)

Anyway it's a moot point as I've written my own requester where you can send default path strings (and files for saving), so suck on that Microsoft you beta-whoring sons of dogs.

I liked the functionality a lot of amiga programs had, where upon accessing different filetypes, it could remember the default path for each filetype (i.e. Dpaint had remembered the paths for Images, Brushes and Anim's all seperately)

If anyone feels they could make use of the code, post a heads up on this topic and I'll post it in the code archives.

Oh, and got to say I'm becoming more and more impressed with Blitz+. Listboxes are great.


Cold Harbour(Posted 2004) [#16]
Sorry to bump this out of antiquity.

I've just come up against this problem. No matter what I do the file requester always go to "My Documents".

Anyone have a workaround?

Thanks!


Beaker(Posted 2004) [#17]
This is fixed in v1.39, using the new 4th parameter.


Cold Harbour(Posted 2004) [#18]
Oh yeah, missed that. Ta.

/embarrassed


Bremer(Posted 2004) [#19]
The manual,even v1.39 of it, only list 3 parameters.


Gabriel(Posted 2005) [#20]
I'm using 1.40 and the fourth parameter is completely ignored. It still goes back to my documents no matter what.


Beaker(Posted 2005) [#21]
Looks like it was broken again in v1.40. :/