Page 1 of 1

Remember last opened directory

Posted: Tue Sep 08, 2009 12:38 pm
by popper
I just downloaded the test version, and every time I want to look at one of the example programs, it forgets where I last opened a file, it defaults to "My Documents", so I have to traverse the directory structure all the way back to the PureBasic Windows "Program Files" Examples sub-directory. It should remember where you last opened a file and use that as the default the next time you open a file. If I was programming, I would want it to remember the directory I used, since I tend to structure things under a primary directory, so I can just go up one directory and go to another project. This is highly irritating and I was surprised that it would act this way at this late date. I know that some file open dialogs don't support this functionality, but it should use it for those that do.

Posted: Tue Sep 08, 2009 12:51 pm
by Kaeru Gaman
it stays in the directory of the topmost Tab's source.

open one code in "Examples\Sources" and one in "Examples\Sources - Advanced"
depending on which Tab is topmost, the OpenFile dialog will default to Sources or to Sources - Advanced.
this behaviour is wanted, because it helps organizing different projects with different includes within the same IDE.

so, if you want to look up more examples, keep one example open to let the OpeFile Dialog open in the "Examples\Sources" directory.


additionally, you can create a link within your "My Documents" folder that brings you directly to your PureBasic folder.
I have this for a lot of Applications and my creative Grafix folders, because none of them is even on C:

Re: Remember last opened directory

Posted: Tue Sep 08, 2009 1:34 pm
by UserOfPure
The full version has a "Source directory" setting in the Preferences where you specify the location that it defaults to. Is that not in the demo?

Posted: Tue Sep 08, 2009 2:33 pm
by Trond
Simply clear the "source directory" field in the preferences and things should start to behave normally again.

Posted: Tue Sep 08, 2009 7:07 pm
by popper
Thanks. Yeah, those are work-arounds (that I've used with other programs when I had to), and I thought I messed with the prefs to make it do what one of you said, and it didn't work, but I may not have changed the right pref.

However, it really shouldn't always open up in a specific directory, unless that is what you want and you have selected that.

It would be nice if it "did it right". (imo, that is just basic functionality)

Posted: Tue Sep 08, 2009 7:33 pm
by Kaeru Gaman
as I explained, it is NOT basic funktinality to open the last opened Directory,
if A DOZEN DIFFERENT DIRS could be the "last opened". Image

it only opens in a specific directory wich you can setup in the prefs,
if you open a file upon an empty Tab.

so, it "does it right", but maybe you don't get "what is right" at first glance.

Posted: Tue Sep 08, 2009 8:01 pm
by popper
"Normal processing" would be to use THE LAST OPENED DIRECTORY. (period) (and usually also saved to directory, whatever the last operation was)

Almost all Windows programs (and Mac, too, I believe) function that way. And I'm pretty sure that is considered standard operating procedure and the "correct way to do it" based on the various "standards" that MS and others have published. (it's been awhile since I've studied that stuff)

If you wanted to get smart about it, you could open based on the last opened directory for a "project" on a project-by-project basis. (depending on what project you are "in" in the IDE)

And/or you could open based on whatever directory in which the current/selected tab file is located. (how my editor works, which is better than nothing)

You could actually have more than one open button for those options, and that would be nice functionality and a great feature. I wish my current editor worked that way.

1) Open in my specified default directory (set in prefs)
2) Open in the actual last used directory (open and/or save, maybe split as two options -- sometimes that would be nice)
3) Open in the directory that the current selected tab file is located
4) Open in the default directory for the current project (if you have a true project-based setup)

But you are wrong in your supposition as stated.

Posted: Tue Sep 08, 2009 8:18 pm
by Kaeru Gaman
well, I'm kinda tired of people who start in the forums and want to tell us "what is wrong".
there are tons of Apps in the world that do it in different ways.
the way the IDE does it is quite comfortable.

Posted: Tue Sep 08, 2009 8:57 pm
by Demivec
popper wrote:1) Open in my specified default directory (set in prefs)
2) Open in the actual last used directory (open and/or save, maybe split as two options -- sometimes that would be nice)
3) Open in the directory that the current selected tab file is located
4) Open in the default directory for the current project (if you have a true project-based setup)
The IDE actually does 1 and 3. If 4 is not implemented it will be when the newest beta is done.

Item 2 is well, IMHO not necessary. If you're not operating on a source you've loaded (in a tab) or a project, or the default directory, you're going to have to navigate to it anyway.


In reference to your comments regarding MS Windows standards, there aren't any. To obtain the functionality of being able to have programs open or save to the last directory that was open or saved to I've had to aquire a custom program to do just that. From my experience few programs include that as a feature. They usually open up in a custom directory they specify (i.e. or according to MSDN, MyDocuments) or if they remember a setting it is only as long as they are running.

Posted: Wed Sep 09, 2009 9:32 am
by Trond
This is how it works in PureBasic:

- The open file window opens in the directory where the currently opened file is saved. This behaviour is non-standard, but very handy, since it allows you to do exactly what you want to (have the file open dialog start in the examples directory when you just opened an example).

- If the currently opened file is not saved (it's a new file), the open file window opens as specified in the preferences.

The preferences works like this:
- If the preferences field Editor -> Source Directory is filled with a valid value, the open file dialog opens there.
- If the field is empty, the default behaviour of Windows is used. Windows automatically remembers the last directory for each openrequester ever used in the system, up to a certain limit (so if you use like 100 other open requesters, Windows will forget the location of this one). This is the standard Windows behaviour.
1) Open in my specified default directory (set in prefs)
2) Open in the actual last used directory (open and/or save, maybe split as two options -- sometimes that would be nice)
3) Open in the directory that the current selected tab file is located
4) Open in the default directory for the current project (if you have a true project-based setup)
The PB IDE always does 3), and it does 1) or 2) (with separate settings for open/save) depending on the preferences. If you select the tab that says "Project" (when a project is open), the IDE will do option 4).

Since the IDE already does what you want, and you are unable to see it, I don't know how to help you any further.