If your application relies on having hard-coded paths to places where it accesses files (a really, really bad idea most of the time, by the way), then there are any number of ways to ensure that:
- use an actual installer that creates (and populates) these directories when your app is installed
- look for and create the directories when the app is run up if they don't exist
- if you distribute your app as a zip file, then add those directories when you create the zip file. They will be created when the file is unzipped.
Why is it a really, really bad idea to create hard-coded directories?
- On Windows 10, apps run with ordinary User permission aren't allowed to create files or directories in Program Files or Program Files (x86)
- Having hard-coded files runs counter to the Windows preferred method of having app-specific data in AppData and user-specific data under Users.
- Maybe the user has a small solid state disk as a C: drive, and doesn't want it cluttered up with app-related data files, or maybe has several PCs and keeps the stuff he wants to move from PC to PC on a removable USB drive (like I do).
Qt has a whole set of OS-friendly ways to create App and User-specific files at run-time (see QStandardPaths), as well as to run standard programs (see QDesktopServices). You can also Google for Qt Windows deployment and read all about what is required to successfully deploy a Qt app on a system where no Qt development tools are installed.
Bookmarks