Proper Directory for saving data files.

Post

Posted
Rating:
#1 (In Topic #776)
Regular
Diverod is in the usergroup ‘Regular’
I tried searching for something here but it said my words were to common, so it ignored them. :(

Being new to Linux/Ubuntu I wanted to ask if there is a preferred directory for saving data files from an application?
Thanks, RodG.
Online now: No Back to the top

Post

Posted
Rating:
#2
Guru
BruceSteers is in the usergroup ‘Guru’

Diverod said

I tried searching for something here but it said my words were to common, so it ignored them. :(

Being new to Linux/Ubuntu I wanted to ask if there is a preferred directory for saving data files from an application?
Thanks, RodG.

you'll want the .config dir in your home directory i should think, use a folder in there with the same name as your application…

Code (gambas)

  1. User.Home &/ ".config" &/ Application.Name
  2.  
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Regular
cage is in the usergroup ‘Regular’
You can also save the data file in the same directory as your program.

Code (gambas)


Or you can save it to a dedicate folder like Bruce suggested.
Myself I tend to save my data files in the folder as my program..
Online now: No Back to the top

Post

Posted
Rating:
#4
Regular
Diverod is in the usergroup ‘Regular’
 Thanks, didn't want to head down a road that could turn bumpy later.
I can see where each of these could be a preferred method over the other depending on the type of data being saved.
Online now: No Back to the top

Post

Posted
Rating:
#5
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
 Consider the scope of your data.
If it is ephemeral, i.e. pertinent only to an instance of your project, then store it using the Gambas Temp mechanism.
If it is pertinent to the user running the project then store it somewhere in "~". As Big B Bruce says you can use the .config/gambas3 dir but I generally shy away from that for purity reasons.
If it is pertinent only to the project you MAY store it in the project directory. However, you MUST understand relative pathing if you do that, otherwise you will get totally confused later. Also you must understand the Gambas project directory structure.
If it is system wide, then store it in a shareable directory, for example /srv.

The only data I store in the project directory is project metadata and then only after considerable thinking about what data might go in there at a later date.

I have spoken.
b

Online now: No Back to the top
1 guest and 0 members have just viewed this.