[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    HOWTO: locate/locateLocal
From:       Waldo Bastian <bastian () ens ! ascom ! ch>
Date:       1999-06-24 15:40:06
[Download RAW message or body]

On The Usage Of 'locate' and 'locateLocal' in KDE2.0

Typical KDE applications use resource files in one out of
three ways:

1) A resource file is read but is never written. A system
   default is supplied but the user can override this
   default in his local .kde directory:
   
   // Code example
   myFile = locate("appdata", "groups.lst")
   myData =  myReadGroups(myFile);

2) A resource file is read and written. If the user has no
   local version of the file the system default is used.
   The resource file is always written to the users local
   .kde directory.

   // Code example
   myFile = locate("appdata", "groups.lst")
   myData =  myReadGroups(myFile);
   ...
   doSomething(myData);
   ...
   myFile = locateLocal("appdata", "groups.lst")
   myWriteGroups(myFile, myData);

3) A resource file is read and written. No system default
   is used if the user has no local version of the file.
   The resource file is always written to the users local
   .kde directory.

   // Code example
   myFile = locateLocal("appdata", "groups.lst")
   myData =  myReadGroups(myFile); // File might not exist!!
   ...
   doSomething(myData);
   ...
   myFile = locateLocal("appdata", "groups.lst")
   myWriteGroups(myFile, myData);

Don't forget to #include <kstddirs.h>

Hopes this help,
Waldo
-- 
KDE, A New Millennium, A New Desktop                      http://www.kde.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic