#11 2009-02-14 18:01

Andrew
Senior Member
Registered: 2008-05-22
Posts: 542

Re: Presets Directory in VirtualStore

report wrote:

Since I think that a program should not use the registry at all(!)

I quite agree! That's precisely why I love truly portable apps like ReNamer. smile

But the problem is, relocating the INI might destroy the very portable nature of the app. The reason I said the registry must be involved is what I have written above:

Andrew wrote:

However, I foresee a big problem here. Currently, ReNamer can blindly create its INI etc. in the dir where the EXE resides. Now if the INI were to be saved in some other location, how would the program know where it was? Then it might have to save the path to a registry key or something, which I absolutely do not think is the way to go.

If you don't want to use the registry, then that's what I asked you, how exactly would you solve this problem? Where would the program store the path to the INI file, since the INI file is auto-loaded and saved and not manually touched?

Last edited by Andrew (2009-02-14 18:08)

Offline

#12 2009-02-14 18:12

report
Member
Registered: 2009-01-05
Posts: 40

Re: Presets Directory in VirtualStore

The path to the INI file must be stored within(!) the INI file itself.

A user of an application should be sensible enough not to move the INI file by himself. Let the program do it just when the user has entered a new path (by the new command Presets | Directory).

Nevertheless, a program should be programmed defensively, i.e., not crash if the INI is not found. Instead it should use its hardcoded default values instead.

This is how every application does it that allows the user to specify the presets location.

So there is no problem. You just fear some that does not exist :)

Offline

#13 2009-02-14 18:42

Andrew
Senior Member
Registered: 2008-05-22
Posts: 542

Re: Presets Directory in VirtualStore

report wrote:

Nevertheless, a program should be programmed defensively, i.e., not crash if the INI is not found. Instead it should use its hardcoded default values instead.

Yes, this is how ReNamer operates at present. If you move/delete the INI from the program directory, it will reset to its defaults and just create a new one.

report wrote:

The path to the INI file must be stored within(!) the INI file itself.

Ok, that's ridiculous (!) and now you're confusing me as well. wink Let me spell this out for you:

1) ReNamer normally creates its INI wherever its EXE resides, say C:\ReNamer.

2) You specify that you want to save the INI in D:\Ini, so the INI duly gets saved there and the path to it (D:\Ini\ReNamer.ini) is stored inside the INI itself.

3) ReNamer starts up and looks for its INI. Now where should it look? How will it know that the INI is stored in D:\Ini? And if it doesn't know D:\Ini exists, how can it read the path from D:\Ini\ReNamer.ini? And if it can read the path from D:\Ini\ReNamer.ini, then what is the need of reading the path in the first place, for hasn't it already found the file?!

So there is a problem and I am certainly not cooking one up just to have fun. I hope you've understood the problem, for I've been trying hard to explain it in the last 3-4 posts at least. The path to the relocated INI will need to be stored somewhere in a fixed location (not in the INI itself!) and read by ReNamer on startup/exit. If that path is to be stored in the registry, then the portability of the app is destroyed. Got it? (Phew!)

Last edited by Andrew (2009-02-14 18:51)

Offline

#14 2009-02-14 19:09

report
Member
Registered: 2009-01-05
Posts: 40

Re: Presets Directory in VirtualStore

Ah... Now I got it! Interesting. I do not see an immediate solution to that problem, except for the registry, a dummy pointer file in the program directory (Vista: automatically shifted to \VirtualStore), or a clone in the default Vista / default XP / etc. user tree, too bad. For my taste good enough but looks pretty inelegant. I am beginning to understand why so few programs bother to offer the feature.

Ok - if that should not be considered desirable, let me relax my suggestion: allow to Export As and Import From (i.e., with path selection, e.g., via a file tree GUI) so that one does not need to copy manually from ..\VirtualStore\.. This does not solve the two mentioned bugs though; they need extra care then.

Offline

#15 2009-02-14 19:36

Andrew
Senior Member
Registered: 2008-05-22
Posts: 542

Re: Presets Directory in VirtualStore

Well, since we've abandoned relocating the INI, now only the issue of Presets remains.

Currently, Presets -> Save As saves to <ReNamerDir>\Presets without asking (creates the subdir if it doesn't exist). Also, Presets -> Import copies the selected preset files to <ReNamerDir>\Presets from where you can run them.

So let's get this straight now. You want:

1) Presets -> Save As to display a standard Save dialog so you can specify the path for every preset you want to save

2) Presets -> Import will be superfluous as you don't want to write to the ReNamer dir

3) The Presets Manager will have a Browse button to browse for and locate presets, but the presets will be loaded from their existing locations

4) The Presets -> Load submenu will show the presets in the standard <ReNamerDir>\Presets dir, as well as any presets loaded via the Presets Manager

There, have I got everything down or did I forget something? tongue Note that this seems to be a lot of work, and I'm not entirely certain Denis will approve. neutral

Offline

#16 2009-02-14 19:48

report
Member
Registered: 2009-01-05
Posts: 40

Re: Presets Directory in VirtualStore

Before I can answer in detail, we should first find out how the bugs can be avoided. Do they depend on not locating the INI file or on not locating the files in \Presets? If the INI should be involved, then different lookup locations cannot be avoided. I.e., Renamer should also check the existence of the AppData path and look there in case the Windows version might be Vista or Windows 7.

(Whether (2) is as superfluous as you suggest I also cannot answer yet.)

So how are the bugs caused from the view of Renamer's code?

Offline

#17 2009-02-14 20:07

Andrew
Senior Member
Registered: 2008-05-22
Posts: 542

Re: Presets Directory in VirtualStore

report wrote:

So how are the bugs caused from the view of Renamer's code?

Umm, wrong guy to ask! Denis has to answer that.

But before he does, let's straighten out some issues...

1) Relocating the INI leads to problems as we've seen. This is not a 'bug' in the true sense of the term as programmers use it, for a bug is a problem with the program's code, and here the code is not at fault.

2) So let's leave relocating the INI out of the picture, shall we, unless you can solve the problem of where to store the INI path (not the registry please!)

3) Relocating the Presets is a whole different issue, and can be done if Denis wishes it so. I mentioned some things to be considered for relocating presets in my previous post above. Basically, allowing presets to be loaded and run from a different dir (instead of copying it to the Presets subdir first) and allowing users to save presets to a different dir will solve your problem.

4) Regarding Presets | Browse and Presets | Manage | Edit, the error is because you've not given write access to the dir. Since you don't want to provide this access, the only way out is to store the presets somewhere else. And yes, this might indeed be construed as a bug of sorts under Vista. smile

5) Now I think we need to wait for Denis to decide how best to solve this...

Last edited by Andrew (2009-02-14 20:18)

Offline

#18 2009-02-14 20:14

report
Member
Registered: 2009-01-05
Posts: 40

Re: Presets Directory in VirtualStore

A program runs in the context of an OS and so not working properly in that context is a "bug" in a broader sense of its meaning. - Anyway, we do need to wait for Denis' background information :)

Offline

#19 2009-02-14 20:25

Andrew
Senior Member
Registered: 2008-05-22
Posts: 542

Re: Presets Directory in VirtualStore

BTW, since the ReNamer dir doesn't have write access, doesn't that mean that any changes to settings are also not saved across sessions? So you basically want the ReNamer dir to be completely read-only. Frankly, I cannot see the point of running it like this and it does sound funny to me, but maybe Denis will agree with you and change the app to relocate all the files that ReNamer writes to... Or maybe he might come up with some clever workaround, who knows? All the best! smile

Offline

#20 2009-02-14 22:17

report
Member
Registered: 2009-01-05
Posts: 40

Re: Presets Directory in VirtualStore

Renamer under Vista does remember changes in the preferences because they are saved. It is just that the physical location of the files is VirtualStore, and Vista takes care of that of the necessary redirection. But apparently this depends on some circumstances I am not aware of yet. Otherwise the bugs could not occur. My first guess would be: hard-coded paths like C:\Program Files instead of variables like %ProgramFiles%; maybe Vista redirects only the latter? Or some such cause.

Offline

Board footer

Powered by FluxBB