Author Topic: To .config or not .config  (Read 9658 times)

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4713
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
To .config or not .config
« on: September 30, 2022, 02:47:33 am »
Hi

I noticed that some Linux ported apps create their configuration files inside /.config inside the /home directory (example featherpad), but some other applications just go directly to the /home. (example Doodle, Tea).

Do you know if this is something hardcoded on the application, or if it something that can be adjust on compile time (when it is compiled on the OS/2 platform)?

I would prefer everything to try to get standarized and use /.config but I'm not sure if that should be a standard thing on the Linux apps. Is there any recommendation to use .config for Linux developers? Or was something interpreted for the OS/2 platform ports? I was not able to find about it on the internet.

Regards

« Last Edit: September 30, 2022, 02:49:10 am by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2092
  • Karma: +159/-0
    • View Profile
Re: To .config or not .config
« Reply #1 on: September 30, 2022, 04:01:24 am »
Plenty of *nix apps install their config into ETC/.config - there's no standardisation...

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4787
  • Karma: +99/-1
    • View Profile
Re: To .config or not .config
« Reply #2 on: September 30, 2022, 04:20:04 am »
It's all up to the app. Linux ports usually use $HOME, somewhere under /var for shared configs or for older ones, under /etc but if locally compiled or ported to Windows, /.config.
A well behaving program will also have fall backs, what if $HOME doesn't exist?
The screensaver for example tries for %HOME% first, then tries for the boot drive and if that fails, falls back on c:\os2\apps\SSaver\ and judging by the comments in the code, using %HOME% was a more recent addition.
Generally when porting, it is easiest to go with the flow, which usually means $HOME.

Paul Smedley

  • Hero Member
  • *****
  • Posts: 2092
  • Karma: +159/-0
    • View Profile
Re: To .config or not .config
« Reply #3 on: September 30, 2022, 08:39:54 am »
Hey Dave,

Generally when porting, it is easiest to go with the flow, which usually means $HOME.

Agreed - otherwise you're just asking for code maintenance issues down the track...

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4713
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: To .config or not .config
« Reply #4 on: September 30, 2022, 05:59:16 pm »
Thanks for the feedback.

I was wondering if the ".config" was standarized, because if it was, maybe that can be requested to the original develper (or project owner) of the open source project, so in the next port update it will reflected.  But since it is not standarized, I guess it can be more difficult for the original developer to agree on that.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4787
  • Karma: +99/-1
    • View Profile
Re: To .config or not .config
« Reply #5 on: September 30, 2022, 06:23:45 pm »
Can always wrap the program in a cmd file that sets HOME. Have to test but something like,
Code: [Select]
@echo off
SET HOME= ./config
app.exe
exit
may work for you

jailbird

  • Newbie
  • *
  • Posts: 46
  • Karma: +5/-0
    • View Profile
Re: To .config or not .config
« Reply #6 on: September 30, 2022, 08:41:13 pm »
Thanks for the feedback.

I was wondering if the ".config" was standarized, because if it was, maybe that can be requested to the original develper (or project owner) of the open source project, so in the next port update it will reflected.  But since it is not standarized, I guess it can be more difficult for the original developer to agree on that.

Regards

On the *IX side, it's part of the "XDG Base Directory Specification" @ https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

$XDG_DATA_HOME defines the base directory relative to which user-specific data files should be stored. If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used.

$XDG_CONFIG_HOME defines the base directory relative to which user-specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used.

$XDG_STATE_HOME defines the base directory relative to which user-specific state files should be stored. If $XDG_STATE_HOME is either not set or empty, a default equal to $HOME/.local/state should be used.

Personally I find it annoying, but what can you do?  :)

Alex Taylor

  • Sr. Member
  • ****
  • Posts: 387
  • Karma: +5/-0
    • View Profile
Re: To .config or not .config
« Reply #7 on: October 03, 2022, 01:59:29 pm »
%HOME%/.config is a Qt thing. The built-in Qt routines for reading/writing settings automatically use that location.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4713
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: To .config or not .config
« Reply #8 on: October 03, 2022, 08:31:37 pm »
%HOME%/.config is a Qt thing. The built-in Qt routines for reading/writing settings automatically use that location.

That's something I didn't expect  :o But for example Tea is a Qt app and it does not use the /.config.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4713
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: To .config or not .config
« Reply #9 on: October 03, 2022, 08:34:35 pm »
Hi

I also have a different question but related. Will it work to declare "XDG_CONFIG_HOME" to change the location (obviously for application that respect that) like:
  SET XDG_CONFIG_HOME=C:\HOME\MARTIN\.config;

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4787
  • Karma: +99/-1
    • View Profile
Re: To .config or not .config
« Reply #10 on: October 03, 2022, 10:26:08 pm »
Hi

I also have a different question but related. Will it work to declare "XDG_CONFIG_HOME" to change the location (obviously for application that respect that) like:
  SET XDG_CONFIG_HOME=C:\HOME\MARTIN\.config;

Regards

Only for programs that have implemented it. Grepping sources here, not many.
Amoebax, lastpass-cli, mercurial, pango, qemu, OpenTTD and some QT5 stuff.
Sure there is more but most don't seem to have implemented it.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4713
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: To .config or not .config
« Reply #11 on: January 28, 2023, 06:43:13 pm »
Hi

I get back to this subject in my mind everything I see my /Home directory. I personally prefer all the configuration of linux ported programs goes to .config.

For example, what can I say to the Dooble author so  things got stored on /Home/.config/.dooble ?
That he should adhere to use $XDG_CONFIG_HOME to store configuration files? And link him to something like https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4787
  • Karma: +99/-1
    • View Profile
Re: To .config or not .config
« Reply #12 on: January 28, 2023, 07:41:09 pm »
You could try suggesting it. Problem is that it will break every install where the profile is already in .dooble, not good. You could always set DOOBLE_HOME to point to your preference.
Remember too that a leading dot in a file name on *nix systems means hidden file, so most file managers on *nix will not show these configuration files.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4713
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: To .config or not .config
« Reply #13 on: January 29, 2023, 12:11:12 am »
Hi Dave, thanks for the feedback

SET XDG_CONFIG_HOME=C:\HOME\.config;
and
SET DOOBLE_HOME=C:\HOME\.config;

Both didn't help me to put the \.dooble inside \.config. It didn't work for me.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4787
  • Karma: +99/-1
    • View Profile
Re: To .config or not .config
« Reply #14 on: January 29, 2023, 01:14:52 am »
Perhaps SET DOOBLE_HOME=C:\HOME\.config\Dooble
Maybe need / instead of \