Answer the question
In order to leave comments, you need to log in
What are the best practices for program directory and file structures in Windows?
Maybe I'm just bad at Google, but I can't find any material that describes the structure of programs in Windows at the level of directories and files. Where to install the program? What are the differences between Programs Files and AppData and why is roaming, local and local low in appdata?
What is the best way to store temp files?
And what are the best practices in the internal structure of the program?
Store dll and pictures in their own folders and exe in the root or everything in the root? How do developers usually do here?
I would be very grateful if you shower me with links to materials. (I do not disdain English)
Answer the question
In order to leave comments, you need to log in
For example here: https://en.wikipedia.org/wiki/Directory_structure
I met a similar more detailed document somewhere on the microsoft site, but now I have not found it.
In short:
1. put the program in "Program Files" in accordance with the platform. The internal structure of executable files and libraries is up to you. If you use a bunch of dynamic libraries, then it makes sense to put them into subdirectories. If you have only a small bunch - they can lie in one directory. It doesn't really matter and no one cares.
2. General program settings that apply to all users: in the registry in HKLM and / or in ProgramData.
3. User settings of the program: to the registry in HKCU and/or in AppData.
4.User temporary files: in %TEMP%
5.Project or save files: in %USERPROFILE%\Documents
For all platforms, the rules are the same - throw anywhere you like.
The juice itself is to throw hidden files of caches and archives into system folders on ssd without the possibility of transfer. And since you have Windows, a must-have for a cool developer is to clog the registry, context menu, and quick launch bar.
Some especially advanced ones still manage to build their services under the system user (supposedly anti-cheats, drivers and stuff like that, but we know the truth...).
Temporary files are best stored in a special directory for temporary files. But successful companies prefer to create their own hidden files / directories without the right for the user to delete. Some geniuses prefer not to store temporary files at all, but to download them from the Internet every time (they came up with a cache for a reason). Even better - give an error without an Internet connection, and make the entire interface remote through some electron.
And of course, everything else is built into the exe, and the exe itself is encrypted. And then you never know someone wants to change the icon without asking or delete the autorun video.
Best-practice is determined by the technology of delivery and installation, and some system agreements. Microsoft Docs is full of information about this, for example on the Windows Installer page: https://docs.microsoft.com/en-us/windows/win32/msi...
MSIX packages are put in a different place, and containerized applications store data slightly different layout. Here is a short overview: https://docs.microsoft.com/en-us/windows/msix/desk...
Deal with a specific technology (MSI vs MSIX), and you will find everything. And I beg you, do not try to write your own installer and copy the files yourself to Program Files or wherever you are going. It does not end with anything good, plus you will kill a lot of time in vain (well, unless of course you are burning with a special desire to do this, only then do not show it to anyone).
AppData - user's system hidden folder. Used by programs usually only for temp files.
ProgramFiles is a regular folder created by default for installing programs.
It is better to store the temp file in appdata - then delete it.
The rest I will not tell you, not a developer. But as a user, it is convenient for me when the program files are divided into subfolders. Type - bin, music, data ... and exe in the root
Windows compatibility logo
Search on the msdn site everything is described there
Registry in general it is better not to use
Settings store either in app.config or in the SQLite database
As for dll files store next to the executable file GAC it is better not to use
Plugins and extensions in a separate folder
Images and resources too
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question