Solved Common Folders
-
this morning I can integrate the crude OpenSSL Library. I'm surprised because it was in Linux much easier as in Windows. But now I have a question what is difficult to decide for an Newbie. Ok, in Windows we use a Filestructure and one branch of this structure is reserved that programms can write Datas for make a program persistent. In Windows I use:
SHGetFolderPathA(NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, szPath)
for example. Windows guaranteed that I can write datas in this path. On a "normal" System this path ist the "C:/ProgramData" Directory. I add a Program Name, a Name of a Config File and build a path with QFile, open this File write in and close if the Application ends. Next start of the progam open this file, read it and work with this Datas. I read many arcticles about the Directory Structure of Linux/Unix. If I get no help I decide to use:
PROGRAMDIR=MyProc
PERSDATA=Config/var/$PROGRAMDIR/$PERSDATA.bin
The File are opened with QIODevice::Text, but the Datas encrypted and look like "A107B12...", every Char two binary ASCII Charcters. Is the /var Directory a good decision or another directory are better ? I think about /var/local or /home/... too. Maybe someone has more experience with store datas in linux.
Thanks for help.
-
@TomBombadill Take a look at https://doc.qt.io/qt-5/qstandardpaths.html
To store settings check https://doc.qt.io/qt-5/qsettings.html
You should really stop using native API - Qt is a cross platform framework. -
I'm so sorry. But where I stored Datas is not the business of Qt. And I know that Qt want manage everything with Qt. But please understand, I don't want depend to Qt. Qt is a framework for me. A framework for manage the GUI. I'm a computer dinosaur. I see CScape, Zinc, MFC, wxWidgets, WPF and many other Frameworks comming and going. So I learned that I separate the GUI Parts from the function Parts. I manage some programs since 30 years with this strategy. Don't be Angry, but I think that my way is successful.
-
@TomBombadill said in Common Folders:
But where I stored Datas is not the business of Qt.
Qt is not forcing you to store your data in the paths/settings file it offers through the references @jsulm gave you. These are convenience items to help you, if you wish to use them.
Part of the point of Qt is to provide cross-platform, abstracted solutions for OS-specific issues. Qt is not only for UI, it provides a whole toolkit of functionality.
If you really want to write your own Linux/MacOS/Windows/Android platform-specific code that is up to you. I hope yours is as good/robust as the Qt-supplied stuff. But then be aware if you ask an OS-specific question like you have above in this forum, you are likely to get no response or one suggesting you use Qt methods; so you may want to ask about your OS-specific way in a dedicated OS forum.
-
Yes, you are right. I'm in the wrong Forum. My questions not about Qt, my questions about Linux. So I should search a Linux Forum. Sorry for disturb. But anyway, I inspect what Qt do about the Paths. It's interesting.
-
@TomBombadill said in Common Folders:
But where I stored Datas is not the business of Qt
Maybe you should first read the link?
Nobody is forcing you to do anything.Using https://doc.qt.io/qt-5/qstandardpaths.html you can get paths usually used for specific tasks (like where home directory is, temp location, pictures, videos, application setting) specific for the platform your app is running on. If you want to store something in unusual locations you can still do this, but in most cases a developer should respect the system design guide lines (in fact on mobile platforms you have to)...