Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    Where should I save app data files on N900

    Reply
    shep | # 1 | 2010-02-06, 01:11 | Report

    Hi All,

    I have a Qt app and I want the users to be able to save some config settings in a simple text file.

    I have it all working (now there's a miracle), but I'm saving the file to /home/user/MyDocs/myapp.config

    I'm pretty sure that's a lousey place to put it!

    Is there a convention for where apps should store data files? for my next app I intend implementing a lot more file IO.

    Shep

    Edit | Forward | Quote | Quick Reply | Thanks

     
    wmarone | # 2 | 2010-02-06, 01:16 | Report

    I seem to recall a post or two regarding this recently, however I cannot recall where they are.

    When saving application settings on Linux (and therefore Maemo) you want to save them in the user's home directory, in a subdirectory or file whose name begins with a period.

    Thus the path to your settings directory (or file) would be:

    /home/usr/.myapp
    or
    /home/usr/.myapp.conf

    You can see this on your device if you go to the terminal and type:

    ls -la

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to wmarone For This Useful Post:
    shep

     
    VDVsx | # 3 | 2010-02-06, 12:24 | Report

    Originally Posted by shep View Post
    Hi All,

    I have a Qt app and I want the users to be able to save some config settings in a simple text file.

    I have it all working (now there's a miracle), but I'm saving the file to /home/user/MyDocs/myapp.config

    I'm pretty sure that's a lousey place to put it!

    Is there a convention for where apps should store data files? for my next app I intend implementing a lot more file IO.

    Shep
    If only the app should modify that file, you should put it in '/home/usr/.myapp', in the current location the user will see the file when in mass storage mode, and some users will delete it by accident .

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to VDVsx For This Useful Post:
    shep

     
    zwer | # 4 | 2010-02-06, 12:57 | Report

    Tho, if you plan on storing large files (videos, music, maps, whatever) you should probably put them on the mass storage partition. For my tests I use /home/user/MyDocs/.appName/ . It will show up to users in Mass Storage mode, but not when using PC-Suite Mode... Either way, that should be a place where you store non-essential large data.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to zwer For This Useful Post:
    shep

     
    pbouda | # 5 | 2010-02-06, 20:31 | Report

    I use QSettings in my Qt apps. It creates a config file for you in .config/CompanyName/AppName.conf. You can set the company name and application name when creating the QSettings object:

    QSettings settings("CompanyName", "AppName");
    settings.setValue("myConfigValue", 10);

    I think this is the easiest way to save config data in your application.

    Peter

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by pbouda; 2010-02-06 at 20:44.
    The Following 4 Users Say Thank You to pbouda For This Useful Post:
    crabsody, danielwilms, shep, tetris11_

     
    shep | # 6 | 2010-02-07, 00:16 | Report

    Originally Posted by pbouda View Post
    I use QSettings in my Qt apps. It creates a config file for you ...
    Peter
    Thanks a million for this, I have implemented this now and it works great.

    Edit | Forward | Quote | Quick Reply | Thanks

     
vBulletin® Version 3.8.8
Normal Logout