STR #3370

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]

Return to Bugs & Features ]

STR #3370

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:1 - Request for Enhancement, e.g. asking for a feature
Scope:3 - Applies to all machines and operating systems
Subsystem:Core Library
Summary:use XDG basedir-spec
Created By:gueux
Assigned To:AlbrechtS
Fix Version:1.4.0
Fix Commit:7308bcdb74e34626c6459699cb57371afd7b343b
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

No files

Trouble Report Comments:

Name/Time/Date Text top right image
#1 gueux
07:11 Mar 31, 2017
Right now fltk uses ~/.fltk/

It would be great if it could follow the XDG spec,
and use $XDG_DATA_DIR/fltk instead (or as a fallback).
#2 AlbrechtS
00:17 Apr 01, 2017
Thanks for the suggestion and info (link).

Can you please elaborate what usage you mean with "fltk uses ~/.fltk/"?

I can imagine you mean storage of preference files, or is it anything else?
#3 gueux
00:53 Apr 01, 2017
I did not check all the uses of ~/.fltk in the source, but all of them would have to be moved to $XDG_CONFIG_HOME/fltk/, $XDG_DATA_HOME/fltk/, $XDG_CACHE_HOME/fltk/, etc.

Everytime I use an fltk app, I have at least

Hope that helps :-)
#4 AlbrechtS
04:33 Apr 03, 2017
Thanks for the info. This looks like Fl_Preference data being stored in ~/.fltk/*.

Note: I moved this RFE from 1.3-feature to 1.4-feature (1.3 development is closed).

Note to devs: we'd need to take care to be compatible with 1.3 locations of preference data so the users don't lose old data stored in ~/.fltk/... if $XDG_* points to another place. Old data should be respected (and potentially updated) whereas new data should be created in $XDG_*. We should document this and encourage users to _move_ their data to the new places if they want to use the $XDG_* paths to store their preference data (as the OP requested).
#5 AlbrechtS
05:08 Apr 03, 2017
Please see also STR #3336 for storage location of fluid prefs and data files.

FWIW: here's what *I* currently have in $HOME/.fltk :

blocks.prefs       fluid                      sudoku.prefs
filechooser.prefs  fluid_comments_menu.prefs  test
fldiff.prefs       fluid_comments.prefs
fltk.prefs         fluid.prefs

cut_buffer  source_view_tmp.cxx  source_view_tmp.h

preferences  preferences.prefs

<empty directory>

Note: All files in $HOME/.fltk/ seem to be transient files that should probably be located in $XDG_CACHE_HOME or similar (and should be deleted after fluid exits).
#6 matt
14:28 Jul 07, 2017
The Unix default path for all apps is:


This is from a time when Linux distributions had not yet suggested anything els, and the hidden files in the home directory were pretty much what everyone did.

> $HOME/.fltk/
> blocks.prefs      
Blocks remembers your high score

> fluid
A directory with - you guessed it - transient data

> sudoku.prefs
A rather complete copy of the current state of the game and the user settings

> filechooser.prefs
Only remembers if the prview is on or off

> fluid_comments_menu.prefs 
> test    fldiff.prefs       fluid_comments.prefs
no clue

> fltk.prefs
some general settings for all FLTK instances. Can be changed inside Fluid.

> fluid.prefs
Window positions
#7 gueux
12:46 Dec 12, 2017
Is there any news on this? Thanks!  
#8 greg.ercolano
20:29 Dec 12, 2017
I'm kinda -1 on changes like this; it makes a mess.

It would cause apps compiled with 1.4 vs 1.3 to either be
'incompatible' when switching back and forth, or confusing
by trying to create behavior that supports both old and new.

And who's to say this standard won't just die off in 5 or 10 years.
~/.appname is as old as unix.

It doesn't for me pass the 'easy to remember' test:

    ~/.fltk is *easy to remember*.

    $XDG_DATA_HOME/{fltk|.fltk} and the $HOME/.local/share fallback is not.

Not to mention $XDG_DATA_DIRS which seems to allow multiple search paths.
And there's actually several variables.. $XDG_DATA_HOME, $XDG_CONFIG_HOME,
$XDG_CACHE_HOME.. I guarantee no one's gonna remember or agree on which is
the right one to use for their browser state info vs. window size/app
config info.

It's a messy, complicated spec, and it's platform specific when we don't
need or want it to be (since we support multiple platforms).

I'd find it hard to imagine trying to write my app's documentation
for users; "To find your preferences, on windows+mac its $HOME/.fltk/,
and on linux its [[insert 100 lines of possible places to look]].

Seems to me this is easily supported by making ~/.fltk a symlink to
$XDG_DATA_HOME/fltk for situations that need to follow the spec.
#9 greg.ercolano
20:31 Dec 12, 2017
BTW, that all said, I'm open to other input ;)

It just seems to make a simple thing more confusing.. like systemd.
#10 AlbrechtS
13:48 May 17, 2020
FTR: see also GitHub Issue #79 "Fltk doesn't respect XDG Base Directory standard":

and the related Arch Wiki article "XDG Base Directory"
#11 AlbrechtS
14:21 May 17, 2020
@Greg: I agree that this (the whole standard) appears to be pretty complicated with all the defaults and exceptions, but the basic changes are, broken down to where the FLTK (user) preferences would be located:

  change "~/.fltk/" to "~/.config/fltk"

The new location seems to be as easy to remember as the previous location, particularly since [in the future] all config files *should* be located under '~/.config/'. This has the advantage that the user's home directory doesn't get cluttered with too many config files and dirs. See the OP's message in GitHub issue #79: "I would like to move .fltk out of my $HOME directory and into $XDG_CONFIG_HOME".

However, I do also agree that it would be an issue if you have two different locations in FLTK 1.3 and FLTK 1.4 and switch applications (i.e. FLTK versions), especially as a developer. But this can be resolved by using the old location if the folder '~/.fltk' exists (in both versions) and use the new location '~/.config/fltk' *only* if the old folder does not exist (FLTK 1.4 only).

In this way users can manually move their '~/.fltk' folder to '~/.config/fltk' once they're satisfied with the new location and don't plan to use FLTK 1.3 any more. I believe this to be doable. If need be we could also backport this to a new FLTK 1.3.6 release which would give users a clean (and optional) migration path.

BTW: before I wrote this reply I did "the same" with my Git user (global) config file. I checked `strace git config --global --list` with and found that I had these config files related to Git

  (a) ~/.gitconfig         # git:  old location
  (b) ~/.config/git/gitk   # gitk: new location

I could move '~/.gitconfig' to '~/.config/git/config' and my Git config kept working. Git docs say related to the global (user) config file: "The next place Git looks is the ~/.gitconfig (or ~/.config/git/config) file, which is specific to each user"

Finally it could be as easy as this, either '~/.fltk/*' or '~/.config/fltk/*'. Doesn't sound too complicated, does it?

One final remark (for now): Matt *did* already change and document some of the Fl_Preferences locations in a recent commit in FLTK 1.4 and I'd like to continue this with the new standard in mind. This way we can have this all done in FLTK 1.4.0.
#12 AlbrechtS
13:38 Jan 16, 2023
Fixed in Git repository.

This issue has been fixed in git commit 7308bcdb74e34626c6459699cb57371afd7b343b, as far as Fl_Preferences are concerned. I don't know of any other places where FLTK stores data files by itself (i.e. from within the library).

The old storage location is respected and used if preference files exist, but new preferences are created in the new storage location. Please see the docs for more information:
bottom left image   bottom right image

Return to Bugs & Features ]


Comments are owned by the poster. All other content is copyright 1998-2023 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to ''.