Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix paths #148

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Fix paths #148

wants to merge 2 commits into from

Conversation

scx
Copy link

@scx scx commented Sep 12, 2019

Fix paths

Allow to use a custom path for dictionaries

You can use the --with-dict-dir=PATH option to specify the path for dictionaries, e.g. /usr/share/hunspell, /usr/share/myspell, /app/share/hunspell, /usr/local/share/hunspell, /opt/share/hunspell, etc.

Respect the XDG Base Directory Specification

Add 3 options:

  • --disable-xdg-dirs
  • --enable-xdg-dirs
  • --enable-xdg-dirs=LEVEL

Possible levels:

  • 0: none (disabled)
  • 1: +XDG_CONFIG_HOME
  • 2: +XDG_DATA_HOME
  • 3: +XDG_CACHE_HOME

Print platform specific paths

Print values of the platform specific paths:

  • ?user
  • ?local
  • ?data
  • ?dictionary
  • ?temp

 - Allow to use a custom path for dictionaries
 - Respect the XDG Base Directory Specification
@scx
Copy link
Author

scx commented Sep 12, 2019

Examples

XDG level 0

RHEL

Paths:
?user: "/home/scx/.aegisub"
?local: "/home/scx/.aegisub"
?data: "/usr/share/aegisub"
?dictionary: "/usr/share/hunspell"
?temp: "/tmp"

Freedesktop

Paths:
?user: "/home/scx/.aegisub"
?local: "/home/scx/.aegisub"
?data: "/app/share/aegisub"
?dictionary: "/app/share/hunspell"
?temp: "/tmp"

XDG level 1

RHEL

Paths:
?user: "/home/scx/.config/aegisub"
?local: "/home/scx/.config/aegisub"
?data: "/usr/share/aegisub"
?dictionary: "/usr/share/hunspell"
?temp: "/tmp"

Freedesktop

Paths:
?user: "/home/scx/.var/app/org.aegisub.Aegisub/config/aegisub"
?local: "/home/scx/.var/app/org.aegisub.Aegisub/config/aegisub"
?data: "/app/share/aegisub"
?dictionary: "/app/share/hunspell"
?temp: "/tmp"

XDG level 2

RHEL

Paths:
?user: "/home/scx/.config/aegisub"
?local: "/home/scx/.local/share/aegisub"
?data: "/usr/share/aegisub"
?dictionary: "/usr/share/hunspell"
?temp: "/tmp"

Freedesktop

Paths:
?user: "/home/scx/.var/app/org.aegisub.Aegisub/config/aegisub"
?local: "/home/scx/.var/app/org.aegisub.Aegisub/data/aegisub"
?data: "/app/share/aegisub"
?dictionary: "/app/share/hunspell"
?temp: "/tmp"

XDG level 3

RHEL

Paths:
?user: "/home/scx/.config/aegisub"
?local: "/home/scx/.local/share/aegisub"
?data: "/usr/share/aegisub"
?dictionary: "/usr/share/hunspell"
?temp: "/home/scx/.cache"

Freedesktop

Paths:
?user: "/home/scx/.var/app/org.aegisub.Aegisub/config/aegisub"
?local: "/home/scx/.var/app/org.aegisub.Aegisub/data/aegisub"
?data: "/app/share/aegisub"
?dictionary: "/app/share/hunspell"
?temp: "/home/scx/.var/app/org.aegisub.Aegisub/cache"

@scx
Copy link
Author

scx commented Sep 23, 2019

I wonder if it would be better to use XDG_RUNTIME_DIR for cache/temp, and fallback to XDG_CACHE_HOME if it is not defined.
Currently, I am working on a similar patch for RawTherapee, which is required to share data between the sandoxed environment and the host.
I will come back to this soon.

Copy link

@louisroyer louisroyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This XDG levels thing is in my opinion unnecessary complex.

Some levels make no sense. I can't see a situation where someone would compile with --enable-xdg-dirs=1 or --enable-xdg-dirs=2:

  • at level 1, what should go to $XDG_DATA_HOME would go to $XDG_CONFIG_HOME. This is even worst than using the old $HOME/.aegisub.
  • level 2 is useless: if someone wants cache to /tmp they just have to set $XDG_DATA_CACHE accordingly.

Can't we just eliminate intermediate levels, and actually fully comply to the specification with an additional check for legacy paths at runtime for backward compatibility?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants