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

feat: Consider XDG_DATA_DIRS while searching for plugins #118

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

Conversation

Frack91
Copy link

@Frack91 Frack91 commented Oct 21, 2024

The core.LoadPlugin() function has been refactored to consider XDG_DATA_DIRS (from the FDO basedir spec) instead of having hardcoded paths. By doing so, there is no need to put "plugins.in" through sed anymore. Also, for this reason, the file has been renamed to "plugins.go" and has been removed from .gitignore and Makefile.

The core.LoadPlugin() function has been refactored to consider XDG_DATA_DIRS
(from the FDO basedir spec) instead of having hardcoded paths. By doing so,
there is no need to put "plugins.in" through sed anymore. Also, for this reason,
the file has been renamed to "plugins.go" and has been removed from .gitignore
and Makefile.
core/plugins.go Outdated Show resolved Hide resolved
core/plugins.go Outdated Show resolved Hide resolved
core/plugins.go Outdated Show resolved Hide resolved
This commit reverts changes done to Makefile and core/plugins.in,
and corrects some explanation comments accordingly.
@Frack91 Frack91 requested a review from axtloss October 21, 2024 21:41
Comment on lines +28 to +29
globalPluginPathsEnv, isGPPEDefined := os.LookupEnv("XDG_DATA_DIRS")
if !isGPPEDefined || globalPluginPathsEnv == "" {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
globalPluginPathsEnv, isGPPEDefined := os.LookupEnv("XDG_DATA_DIRS")
if !isGPPEDefined || globalPluginPathsEnv == "" {
globalPluginPathsEnv, isGPPEDefined := os.LookupEnv("XDG_DATA_DIRS")
if !isGPPEDefined || len(strings.TrimSpace(globalPluginPathsEnv)) == "" {

just checking if its equal to "" wouldn't work since the envvar can be just a single space or some other whitespace
also what does GPPEDefined mean? I think something like XDDDefined would make more sense

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.

2 participants