PDA

View Full Version : QSettings - .ini - and storing path to files



el
7th December 2009, 14:52
Hello,

i am using QSettings and IniFormat in a windows-based project.

The idea is to store some basic configuration data as .ini file - which basically works (write to & read from is fine).

Now i am wondering what is the best idea to store entire path to files in an ini.

One issue is the difference between linux path & windows paths - the other issue is the drive-letter.

so the question is:
What is the best way to store paths to files (windows env) in an .ini file - keeping the drive-letter and a working path_structure.


Best regards
el

Lesiok
7th December 2009, 15:19
Qt on all platforms internally is using / (slash) in paths.

squidge
7th December 2009, 15:57
And there is ToNativeSeperators and friends to convert back and forth, so no need to do it yourself.

schnitzel
8th December 2009, 03:29
for example:



lastPath = appSettings->value("myFilePath",QApplication::applicationDirPath()).toString();
...
appSettings->setValue("myFilePath", QFileInfo(fn).absolutePath());



Qt hides platform specific stuff - just try it :)