Recent

Author Topic: Where to save a file so that it cane be easily accessed ??  (Read 6197 times)

newman

  • Jr. Member
  • **
  • Posts: 75
Where to save a file so that it cane be easily accessed ??
« on: February 19, 2010, 03:32:00 pm »
Hello,

I have a question regarding applicaion development in Linux.

My problem is that I need to store a file in a commonly accessible location, so that different applications can access it.

In windows programming the file could be stored in the systems folder.

Since the path to the systems folder was easily retrieved using an API, applications could easily use this API and get the path.

Is there such a folder in Linux (Ubuntu 9.10) which could be easily accessed by any application.

Thanks
ne

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1933
« Last Edit: February 19, 2010, 04:22:51 pm by theo »

Troodon

  • Sr. Member
  • ****
  • Posts: 484
Re: Where to save a file so that it cane be easily accessed ??
« Reply #2 on: February 19, 2010, 05:16:50 pm »
Any user and application can open in read mode pretty much any file or directory (except in other user's home directories and a few other locations). If you need write access, your application installer could create a new directory such as /share/<your_app> or /opt/<your_app> and grant R/W access to it to all users. The installer (or package manager, such as apt/synaptic etc.) usually runs with admin privileges. But keep in mind that, if several users can access a particular file in write mode then your application should be able to avoid race conditions. A database system is a better option for concurrent access to data.
« Last Edit: February 19, 2010, 07:01:51 pm by Troodon »
Lazarus/FPC on Linux

newman

  • Jr. Member
  • **
  • Posts: 75
Re: Where to save a file so that it cane be easily accessed ??
« Reply #3 on: February 19, 2010, 06:23:24 pm »
I meant any application.

The GetAppConfigDir looks ideal. I think this can work for me..

Thanks all


 

TinyPortal © 2005-2018