Home > Uncategorized > Folder resolution of saved data

Folder resolution of saved data

Rewriting zkanji to be cross platform requires certain changes. One of these changes is how the folder, where the program will save its user data, is decided.

Currently zkanji looks into its own data folder where it was installed, and if that’s writable (i.e. because it’s not the “Program Files” folder), it shamelessly starts dumping all its saved data there from that on. Otherwise it looks up the App Data folder’s path and uses that one. (Or at least a sub path in it.) This had the happy consequence that if you installed zkanji on an external hdd and moved it to another computer, it was automatically working like a portable installation.

I think this works fine, and I wouldn’t change it, but I don’t know the preferences of other people and operating systems. So rather than letting the program decide, the new version will ask the user where to save its data. This might be another extra click you might find inconvenient, but at least it should be safer and will only happen once.

The new algorithm will first check whether the data folder on the install path is writable at all. Because if it’s not, there’s no real question what to do. (So the App Data will be used as there is no other location it could safely write to.) If it is writable though, the program will also check for the existence of previously written user data in there. (You could of course fake the user data, making empty files with expected names. Zkanji won’t really check whether they are valid.)

Next it’ll look into the (OS dependent) application data folder, and whether user data exists there already or not. If user data is only found in one location, that location will be used and no questions asked. On the other hand if both are found (and can be written to) zkanji will assume a portable installation. I first thought that it should save the choice in its configuration (or .ini) file, but if there are two folders with user data, both will have a config file, so it would be pointless to check.

Of course you might want to override the automatic choice. In case you have a fresh install of zkanji on a portable drive, and the host computer also has a zkanji installed, the program on the portable drive will assume that it is not portable. It has found user data in the App Data location and nothing on the local install path, so there’s no real way to determine the truth.

In that case, if you want to make the install portable, there will be an option for that in the settings. Once you selected it, user data will be saved to the installed data folder, and no more misunderstandings will arise (hopefully). The other way around, that is, if you want to make the portable install to be non portable, the only way is to move the local data to the App Data location. If I’m not lazy when I get to that part, the program will do it for you. Overwriting existing data will need a confirmation of course.

Hopefully this change won’t be noticeable at all. Already existing user data won’t be deleted or moved around, just used as it is.

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: