In Linux , for example, this folder will be /home/user_name/.app_name , and in Windows , the folder is AppData .

How to get the path to the directory in which you can create the folder .app_name and store the application files?

    3 answers 3

    If you want to cross-platform - you need to look in the direction of cross-platform libraries, for example Qt . There it will be something like QStandardPaths::AppDataLocation .

    At the language level, there are no folders with application files. Even after adding filesystem to the standard library, you will have to rely on some OS settings.

      Such a class is - QStandardPaths . There are examples of real ways - choose what you need. Yes, for this you have to move to Qt :)

      • Does QStandardPaths have source codes? And then move is not a hunt. - pank
      • @pank: And there #ifdef set of #ifdef 's. - VladD
      • Qt source code is open. Only you can hardly pull out functions from it, since they depend on other classes of the framework, and the dependencies can be very deep. - maestro
      • it is possible without packet ifdef. everything is very easy to do :) - KoVadim
      • one
        @maestro, I agree, the source codes did little to help. - pank

      Offhand 2 options:

      1. C: getenv("HOME")
      2. Java: System.getProperty("user.home");
      • And on Windows ? - pank