PDA

View Full Version : Tell tthe program to get stuff from the Current dir...



danoc93
15th February 2012, 08:10
Hi, I am trying to get the program to use the files inside the current dir, but instead I have to tell it to use stuff from an specific location...
For example i want to use qwebkit to load a html file with information about my program, so the user can edit it and the program can get the changes...

I could use resources but those would be included inside the program, making it impossible to edit them...
So I want the user to have a chance to edit some files that the program uses but I can only do that in an specific dir... ex: the program will get a file inside c:/programfolder, so i will have to create that folder inside c in every computer... which is not what i am looking for...


How could I tell the program to get the files from the current dir the .exe is on....

myta212
15th February 2012, 08:21
Hi,
Why you dont create your program to automatic CREATE a directory at specific location (if directory not exist) and USE that directory (if directory exist). I think this method is more simple. You can add this code when user open your program.
You can use :


if (!QDir.exist(yourdirlocation))
QDir.mkdir(yourdirlocation)


You can create that directory in C or at same location with your exe directory.
Thank you.

Best regards,

myta

AlexSudnik
15th February 2012, 09:00
Use QDir QDir::current () [static] function.

http://doc.qt.nokia.com/4.7/qdir.html#current