Proper Directory for saving data files.

New to Gambas? Post your questions here. No question is too silly or too simple.
Post Reply
Diverod
Posts: 28
Joined: Friday 12th November 2021 1:31am
Location: North Central Florida

Proper Directory for saving data files.

Post by Diverod »

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.
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Proper Directory for saving data files.

Post by BruceSteers »

Diverod wrote: Tuesday 7th December 2021 2:47am 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...
User.Home &/ ".config" &/ Application.Name
If at first you don't succeed , try doing something differently.
BruceS
cage
Posts: 123
Joined: Monday 2nd September 2019 5:47am
Location: Phoenix Arizona

Re: Proper Directory for saving data files.

Post by cage »

You can also save the data file in the same directory as your program.
Application.path &/ Application name
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..
Diverod
Posts: 28
Joined: Friday 12th November 2021 1:31am
Location: North Central Florida

Re: Proper Directory for saving data files.

Post by Diverod »

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.
User avatar
thatbruce
Posts: 161
Joined: Saturday 4th September 2021 11:29pm

Re: Proper Directory for saving data files.

Post by thatbruce »

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
Have you ever noticed that software is never advertised using the adjective "spreadable".
Post Reply