deadpixi / sam

An updated version of the sam text editor.
Other
430 stars 46 forks source link

xdg base directory specification #123

Open arturfabriciohahaedgy opened 1 year ago

arturfabriciohahaedgy commented 1 year ago

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 commented 1 year ago

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.