CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2019
    Location
    Michigan
    Posts
    35

    [RESOLVED] An easy question

    I have created 15 different Visual Studio 2012 projects that I want to finish up and build. All of the projects have some sort of "support" files (.dat, .txt, .wav).

    To make things easy, I just put all of the files needed for every program into the ProgramData folder. I did this because I see that other programs I paid for did the same thing. Is this the right thing to do? If not, where should I putt these files?
    Originally I was thinking about placing them in the Program Files (x86) folder with the application. The only problem here is that I would need a separate folder for each app. Any thoughts?

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: An easy question

    Take a look at the following link to Environment.GetFolderPath https://docs.microsoft.com/en-us/dot...ew=netcore-3.1

    The above link is for .c# net core but it should be available for VB.net (depending on the .net framework version you are using).

    Look at the Environment.SpecialFolder enum to decide where to put the files. Keep in mind that some of these locations require elevated access, orhers do not require elevated access and are available to all users or only to a single user.

    Note: the Environment.GetFolderPath should be used rather than hardcoding the paths yourself.

  3. #3
    Join Date
    May 2019
    Location
    Michigan
    Posts
    35

    Re: An easy question

    I know where I am going to place the files because I am coding the installer to put them there. I have additionally experimented with the different folders to learn which require elevated access ans which do not. The program user sometimes needs access to the file, if for example - it is a log file of some sort. Most all of the programs have an option to play sounds and no user intervention is needed here. A few of them use a custom .dat file that I have generated using another coded project and hours of manual formatting. I want to know that the code is going to return the value I expect - not have to guess if it even can locate the proper folder or file. I'll stick to doing what I have been and decide where I can put these files myself. Thank's for the help.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured