User:Suzanne.soy/Data storage: RFC: Difference between revisions
Suzanne.soy (talk | contribs) (WIP, saving to avoid loosing everyting in a browser crash…) |
Suzanne.soy (talk | contribs) (List of standard locations for various types of data.) |
||
Line 2: | Line 2: | ||
** {{incode|$XDG_CONFIG_HOME}} for configuration files, i.e. most of {{incode|.FreeCAD}} |
** {{incode|$XDG_CONFIG_HOME}} for configuration files, i.e. most of {{incode|.FreeCAD}} |
||
** {{incode|$XDG_CACHE_HOME}} for any data that can be deleted and regenerated offline, and caches of things which normally require network access at the moment when they are browsed, so most likely {{incode|.FreeCAD/webdatacache/}} and {{incode|~/.FreeCAD/AddonManager/Images/}} |
** {{incode|$XDG_CACHE_HOME}} for any data that can be deleted and regenerated offline, and caches of things which normally require network access at the moment when they are browsed, so most likely {{incode|.FreeCAD/webdatacache/}} and {{incode|~/.FreeCAD/AddonManager/Images/}} |
||
** {{incode|$XDG_DATA_HOME}} for fonts, icons etc. which are usable by multiple applications. It is the equivalent of {{incode|/usr/local/share}} ({{incode|$XDG_DATA_HOME}} is {{incode|~/.local/share}} by default) |
** {{incode|$XDG_DATA_HOME}} for fonts, icons etc. which are usable by multiple applications. It is the equivalent of {{incode|/usr/local/share}} ({{incode|$XDG_DATA_HOME}} is {{incode|~/.local/share}} by default). FreeCAD already stores some things related to the Qt online help browser in {{incode|~/.local/share/freecad/freecad/freecad.qhc}} |
||
*** There are [https://www.freedesktop.org/software/systemd/man/file-hierarchy.html#Home%20Directory some recommendations] about other directories namely {{incode|…/lib/}} (portable libraries) {{incode|…/lib/<some-arch-id>}} (arch-specific libraries) and {{incode|…/bin/}} (executable libraries) A few tools ([https://www.python.org/dev/peps/pep-0370/ 1], [https://intellij-support.jetbrains.com/hc/en-us/articles/206544519-Directories-used-by-the-IDE-to-store-settings-caches-plugins-and-logs 2]) use the directories other than {{incode|share}}. |
*** There are [https://www.freedesktop.org/software/systemd/man/file-hierarchy.html#Home%20Directory some recommendations] about other directories namely {{incode|…/lib/}} (portable libraries) {{incode|…/lib/<some-arch-id>}} (arch-specific libraries) and {{incode|…/bin/}} (executable libraries) A few tools ([https://www.python.org/dev/peps/pep-0370/ 1], [https://intellij-support.jetbrains.com/hc/en-us/articles/206544519-Directories-used-by-the-IDE-to-store-settings-caches-plugins-and-logs 2]) use the directories other than {{incode|share}}. |
||
*** {{incode|$XDG_DATA_DIRS}} defaults to {{incode|/usr/local/share:/usr/share}} |
*** {{incode|$XDG_DATA_DIRS}} defaults to {{incode|/usr/local/share:/usr/share}} |
||
Line 13: | Line 13: | ||
*** Which one to pick depends on whether we consider these "plug-ins" usable by other tools or whether they are private (which could likely be understood as "FreeCAD-specific"). Branded versions of FreeCAD can share installed macros and mods; and external applications could invoke FreeCAD macros directly (see e.g. how the [https://wiki.freecadweb.org/User:Suzanne.soy/XternalApps_Workbench XternalApps Workbench] invokes Inkscape extensions from within FreeCAD, the reverse would also make sense). Also, since {{incode|~/.local/share}} is not customizable, it seems less useful to move things there (maybe it is a recent |
*** Which one to pick depends on whether we consider these "plug-ins" usable by other tools or whether they are private (which could likely be understood as "FreeCAD-specific"). Branded versions of FreeCAD can share installed macros and mods; and external applications could invoke FreeCAD macros directly (see e.g. how the [https://wiki.freecadweb.org/User:Suzanne.soy/XternalApps_Workbench XternalApps Workbench] invokes Inkscape extensions from within FreeCAD, the reverse would also make sense). Also, since {{incode|~/.local/share}} is not customizable, it seems less useful to move things there (maybe it is a recent |
||
{{incode|$XDG_RUNTIME_DIR}} |
{{incode|$XDG_RUNTIME_DIR}} |
||
** {{incode|$XDG_DATA_DIRS}} defaults to {{incode|/usr/share}} and is a list of places where fonts, icons etc. are stored. {{incode|/usr/share/freecad/mod}} shouldn't be hardcoded based on the Prefix (assuming that's the case), instead (or probably in addition to that) a lookup should be done in all the directories listed in this colon-separated variable. |
|||
{{incode|$XDG_DATA_DIRS}} |
|||
https://wiki.debian.org/XDGBaseDirectorySpecification#state |
|||
/usr/share/freecad/mod |
|||
, |
|||
~/.local/share/freecad/freecad/freecad.qhc |
|||
** {{incode|$XDG_DOCUMENTS_DIR}} as the default location when opening/saving files on a fresh installation (probably already the case, I didn't pay attention; the {{incode|$PWD}} is probably an okay choice especially when started from the command-line) |
** {{incode|$XDG_DOCUMENTS_DIR}} as the default location when opening/saving files on a fresh installation (probably already the case, I didn't pay attention; the {{incode|$PWD}} is probably an okay choice especially when started from the command-line) |
||
** "State" as described [https://wiki.debian.org/XDGBaseDirectorySpecification#state on the Debian wiki] and [https://lists.freedesktop.org/pipermail/xdg/2009-February/010191.html in this mailing list message] is the kind of small values that an application remembers (window position, size of the [[Tree View]], recently used files) which can usually change often (so it is not a good candidate for storing alongside the configuration in a VCS, or at least not for storing in the same repository), and tends to be created without the user making conscious choices or without realizing that these are "settings" (as opposed to actual configuration, which happens e.g. in the preferences editor and involved clicking on checkboxes and making actual choices). There is no standard location for state, and no XDG variable to customize that location; however it seems like a good idea to keep that information in a separate subdirectiory of FreeCAD's configuration directory. Currently some of these details are stored in separate files (e.g. cookies in {{incode|.FreeCAD/cookies}}, the window size in {{incode|.config/FreeCAD/FreeCAD.conf}} instead of {{incode|.FreeCAD/…}} |
Revision as of 12:25, 3 February 2021
- FreeCAD should honor the [ XDG https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
$XDG_CONFIG_HOME
for configuration files, i.e. most of.FreeCAD
$XDG_CACHE_HOME
for any data that can be deleted and regenerated offline, and caches of things which normally require network access at the moment when they are browsed, so most likely.FreeCAD/webdatacache/
and~/.FreeCAD/AddonManager/Images/
$XDG_DATA_HOME
for fonts, icons etc. which are usable by multiple applications. It is the equivalent of/usr/local/share
($XDG_DATA_HOME
is~/.local/share
by default). FreeCAD already stores some things related to the Qt online help browser in~/.local/share/freecad/freecad/freecad.qhc
- There are some recommendations about other directories namely
…/lib/
(portable libraries)…/lib/<some-arch-id>
(arch-specific libraries) and…/bin/
(executable libraries) A few tools (1, 2) use the directories other thanshare
. $XDG_DATA_DIRS
defaults to/usr/local/share:/usr/share
- It is unclear what the difference between
share
andlib
is:- This page on tldp.org says that plug-ins live in
/usr/lib/
, - this page on tldp.org says that "The "share" word is used because what is under /usr/share is platform independent, and can be shared among several machines across a network filesystem",
- this page at freedesktop.org says that
~/.local/lib
is for "Static, private vendor data that is compatible with all architectures" and that~/.local/share
is for "Resources shared between multiple packages, such as fonts or artwork.".
- This page on tldp.org says that plug-ins live in
- The directories other than
share
are not customizable using env vars. - Macros and mods (currently in
~/.FreeCAD/Macro
and~/.FreeCAD/Mod
), when they are installed by the Addon manager, should be in$XDG_DATA_HOME/share
or in$XDG_DATA_HOME/lib
. - Which one to pick depends on whether we consider these "plug-ins" usable by other tools or whether they are private (which could likely be understood as "FreeCAD-specific"). Branded versions of FreeCAD can share installed macros and mods; and external applications could invoke FreeCAD macros directly (see e.g. how the XternalApps Workbench invokes Inkscape extensions from within FreeCAD, the reverse would also make sense). Also, since
~/.local/share
is not customizable, it seems less useful to move things there (maybe it is a recent
- There are some recommendations about other directories namely
$XDG_RUNTIME_DIR
$XDG_DATA_DIRS
defaults to/usr/share
and is a list of places where fonts, icons etc. are stored./usr/share/freecad/mod
shouldn't be hardcoded based on the Prefix (assuming that's the case), instead (or probably in addition to that) a lookup should be done in all the directories listed in this colon-separated variable.$XDG_DOCUMENTS_DIR
as the default location when opening/saving files on a fresh installation (probably already the case, I didn't pay attention; the$PWD
is probably an okay choice especially when started from the command-line)- "State" as described on the Debian wiki and in this mailing list message is the kind of small values that an application remembers (window position, size of the Tree View, recently used files) which can usually change often (so it is not a good candidate for storing alongside the configuration in a VCS, or at least not for storing in the same repository), and tends to be created without the user making conscious choices or without realizing that these are "settings" (as opposed to actual configuration, which happens e.g. in the preferences editor and involved clicking on checkboxes and making actual choices). There is no standard location for state, and no XDG variable to customize that location; however it seems like a good idea to keep that information in a separate subdirectiory of FreeCAD's configuration directory. Currently some of these details are stored in separate files (e.g. cookies in
.FreeCAD/cookies
, the window size in.config/FreeCAD/FreeCAD.conf
instead of.FreeCAD/…