How to name path for App Data to use on different computers

207 Views Asked by At

I created a simple application to allow users to register, add friends, and send private DM's.

I made the mistake of using local paths relative to my machine to import/export fstream .txt files for storage.

For example, the global list of users is located in:

C:\Users\19097\Desktop\Programs\Registration Application\App files\usernames\usernames.txt

This will obviously not work when ran on another computer. So my question, how can I create this directory of Storage for the objects in the app relative to the user?

I have briefly read on environment variables and from my understanding of it, they are used to reference various default window paths.

Since I do not know where the user would install and save the application files, how can I still create and read files dynamically, within a certain path relative to the computer it is installed on?

For example:

[Whatever this path is]\Registration Application\App files\usernames\usernames.txt

0

There are 0 best solutions below