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

xdg base directory specification #123

Open
arturfabriciohahaedgy opened this issue Sep 28, 2022 · 1 comment
Open

xdg base directory specification #123

arturfabriciohahaedgy opened this issue Sep 28, 2022 · 1 comment

Comments

@arturfabriciohahaedgy
Copy link

Hi, not really an issue, more of an improvement, would like to know if sam could be made to look for it's samrc in two places:

  1. In the home directory, or ~/.samrc
  2. In the $XDG_CONFIG_HOME/sam folder, or ~/.config/sam/samrc

And so, following the XDG Base Directory Specification.

Also, sam creates some files in the home directory, would like to know if there's a way to change this behavior to some specific folder, and if there isn't a way to do it, if it could become a feature in the future...

@arturfabriciohahaedgy
Copy link
Author

arturfabriciohahaedgy commented Sep 28, 2022

Posting this to help someone who may has had the same issue as me.

I was reading the source code and I saw this

if (getenv("SAMRC"))
        strncpy(rcpath, getenv("SAMRC"), PATH_MAX);
else
        snprintf(rcpath, PATH_MAX, "%s/.samrc", getenv("HOME") ? getenv("HOME") : ".");

So... You can just put something like this in your .bashrc/.zshrc (don't know about fish):
export SAMRC="$HOME/.config/sam/samrc"

Although I solved the problem, I'd still like to know about the possibilty of moving the files generated by sam on the home directory to another place, maybe the same as the SAMRC environment variable.

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

No branches or pull requests

1 participant