Define path inside Application forder writable
-
I need to define the path of the file I created inside the application folder into QFile. As an example, I created a text file and while giving the file path, I give it with the file path of my own computer. as file:///C:/Users/umutc/Desktop/test.txt.
My problem is that when I run the application on another computer, it will not find this file path. How can I identify a file inside application files? I defined it in the Resources folder, but it doesn't work for me because it is readonly. I have to write. -
I need to define the path of the file I created inside the application folder into QFile. As an example, I created a text file and while giving the file path, I give it with the file path of my own computer. as file:///C:/Users/umutc/Desktop/test.txt.
My problem is that when I run the application on another computer, it will not find this file path. How can I identify a file inside application files? I defined it in the Resources folder, but it doesn't work for me because it is readonly. I have to write.Use
QStandardPath
. There you can make sure that you get the home directory or desktop of the user on any computer. -
-
I need to define the path of the file I created inside the application folder into QFile. As an example, I created a text file and while giving the file path, I give it with the file path of my own computer. as file:///C:/Users/umutc/Desktop/test.txt.
My problem is that when I run the application on another computer, it will not find this file path. How can I identify a file inside application files? I defined it in the Resources folder, but it doesn't work for me because it is readonly. I have to write.@TheCeylann
In addition to what the others are correctly telling you about usingQStandardPaths
, when an end user installs your app on their computer it may well be the case that they do not have permission to write anything into the executable folder and/or the folder where any app files were installed.