Writing file and opening file working on dev but not on release.
-
Hello everyone,
I'm developing a simple app on my Mac.
With a QplaintTextEdit, I write in file, and at the opening of the app I read the file to inject it in the editor
When I run the app from QtEditor everything is working fine.But If I go into the folders generated by QtEditor (release/profile/debug) and start the app, nothing is write in the file. (there no file btw)
So I opened the mac package and I see my "note.txt" but the only text that is in it, is the text I wrote when I launched the app with QtEditor, not with app generated by Qt.
I hope it is a little bit clear.... Cause I don't find the problem :)
I create a file with a simple
QFile file("note.txt")
No other path.
Maybe I need to set another directory like /opt or something else ? But If I run the app on windows, I don't know what will happen .Thanks in advance.
Nicolas. -
Hi and welcome to devnet,
The rule is: do not create files relative to the executable. Most of the time your users will not have write permissions in that folder. You should use QStandardPaths to query a suitable folder for that like the Documents folder.