David Elizalde
David Elizalde

Reputation: 81

Is there anyway to ask the user to specify the application's folder location?

I'm working on a project which the user needs to install in his computer. Let's say this program works with 6 different folders assigned to different purposes (One stores .txt files, another stores picture files, etc).

What i would like to achieve is to make the user specify these folders during installation, then create a settings file with this information for the application to work with, is this possible?

Upvotes: 1

Views: 40

Answers (1)

Stein Åsmul
Stein Åsmul

Reputation: 42136

My take on issues like these is to make your application itself suggest some folders to create on first launch and let the user override them. Another approach is to just create the default folders and create a preference dialog in your application to override them.

You can set up folders in the setup, but there are an increasing amount of problems related to all kinds of operating system features that interfere and cause problems that are hard to predict. Issues such as UAC, permission issues, impersonation contexts, etc... With every new version of Windows new obstacles are created that setups must deal with.

There are several benefits when you make the application handle its own data setup rather than doing so in a setup:

  1. You are always running in the context of the right user who will use the application (unless you are delivering and running as a service).
  2. You have superior methods to handle unexpected error conditions and problems that occur during application setup via exception handling and dialog with the user. A setup can also handle a lot of this, but not with the same precision and interactivity.
  3. It is much easier for a developer to grasp the issues that occur during data setup when it is done via the application.
  4. User data can be installed read-only to program files and then copied to each user. This even makes it possible to make the application fix pre-existing errors in the user data.

All of this is a much larger discussion of application data handling and setup. Things should be kept as simple as possible. If more details are interesting you can check this discussion.

Upvotes: 1

Related Questions