You are here

How to set up an app to use the AppNamePortable\Data\settings directory

7 posts / 0 new
Last post
elegemvanbelole
Offline
Last seen: 13 years 8 months ago
Joined: 2011-04-05 09:51
How to set up an app to use the AppNamePortable\Data\settings directory

Greetings for you all!

I'm trying to create a portable version of Vectir. This is a handy little tool, which allows you to use your Bluetooth enabled mobile phone to remotly control your pc. I want to make the so-called server part of this tool portable.

I've created a launcher for this app, and it launches the app allright, however, the app still creates a directory on my local hard drive to store its settings in it. I tried to figure out how to make the app use the VectirPortable\Data\settings directory, but the more I read, the more confused I got.

What I'm asking for, is a clear, step-by-step explanation, on how to solve this problem.

Any help is appreciated!

Thx

dagardner
dagardner's picture
Offline
Last seen: 5 years 5 months ago
Developer
Joined: 2007-09-20 14:41
Is there an option in Vectir

Is there an option in Vectir to specify where settings are stored? If not, you may need to copy the settings to Data on PortableApp closes, and copy the settings back to where Vectir expects them when the PortableApp starts.

Take a look at DirectoriesMove.

elegemvanbelole
Offline
Last seen: 13 years 8 months ago
Joined: 2011-04-05 09:51
No option to specify settings location

Thanks for your reply! Vectir does not have an option to specify the settings location. It stores its settings in a subdirectory of the default "C:\Documents and Settings\Username\Local Settings\Application Data" directory of windows.

So, if I understand things correctly, the following needs to be done:

1. On launching Vectir, the contents of the VectirPortable\Data\settings directory must be moved to the directory on the local drive, where Vectir would nomally create the files.
2. After Vectir is closed, the files must be moved back to the VectirPortable\Data\settings directory.

Is there no way to use the Data folder on the portable device instead of the "c:\Documents and Settings\Username\Local Settings\Application Data\Vectir" directory (This is where Vectir normally stores its settings)? Maybe some kind of environmental setting?

Thx!

mjashby
Offline
Last seen: 10 months 1 day ago
Developer
Joined: 2008-09-19 13:35
Portable Settings

You have to work with what the base application allows you to do, so if it insists on putting its settings in Appdata, initially you have to copy this structure to your portable version (DefaultData) Folder. This will be automatically copied to the Data Folder on first run of your portable version. You will then need make the necessary entry/entries in the VectirPortable.ini file to move the files back and forth between the 'Data' and 'Appdata' Folders on start-up and closure of the program.

By the way, I hope you're just doing this for personal use, as Vectir is a commercial application.

MJA

3D1T0R
3D1T0R's picture
Offline
Last seen: 3 years 5 months ago
Developer
Joined: 2006-12-29 23:48
Environment Variable Substitution?

If you're using PAL, you could try adding an [Environment] section to your launcher.ini to substitute the %LOCALAPPDATA% Environment Variable with the %PAL:DataDir% Environment Variable.

This could be done with something like the following.

[Environment]
LOCALAPPDATA=%PAL:DataDir%

I can't guarantee that it will work for Vectir (haven't tried Vectir myself), but I'd say it's worth a try if you really want Vectir to be portable, and if it doesn't work, then as MJAshby says, you'll have to move the files back and forth (which can easily be done with the [DirectoriesMove] and [DirectoriesCleanupIfEmpty] sections)

For more information please refer to the PAL Documentation (and thank Chris Morgan not only for all his work writing PAL, but also for actually taking the time to document it :))

~3D1T0R

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 6 months ago
Joined: 2007-04-15 21:08
LOCALAPPDATA is PAL

LOCALAPPDATA is added by PAL. It's not going to be used by apps. It's there so that there's a way of accessing that directory on the local machine (as there's no environment variable copy of it like there is for APPDATA).

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

3D1T0R
3D1T0R's picture
Offline
Last seen: 3 years 5 months ago
Developer
Joined: 2006-12-29 23:48
Oh sorry.

I misunderstood then (not surprisingly, ... I have a tendency to do that every once in a while)
but anyway, perhaps it uses an Environment Variable, and my example above could still be used as a template, even if it apparently defeats the purpose of LOCALAPPDATA if used exactly as is.

~3D1T0R

Log in or register to post comments