Skip to content

Commit

Permalink
Let slurm search themes in $PREFIX/share/slurm
Browse files Browse the repository at this point in the history
Instead of a bunch of hard-coded paths we now search in the PREFIX path.
This fixes #14

Signed-off-by: Matthias Schmitz <matthias@sigxcpu.org>
  • Loading branch information
mattthias committed Feb 3, 2024
1 parent 73b532b commit 58655d7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions theme.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ int theme_readfile(theme * t, char *name)
FILE *f;
char buf[BUFSIZ + 1];
char filename[BUFSIZ + 1];
char *search_paths[5];
char *search_paths[3];
char *p, *val, *key;
int iter;
char pref[sizeof(INSTALL_PREFIX)+15];

strcpy(pref, INSTALL_PREFIX);

t->complete = E_NULL;

Expand All @@ -64,11 +67,9 @@ int theme_readfile(theme * t, char *name)
*/
search_paths[0] = "."; /* local directory */
search_paths[1] = strcat(getenv("HOME"), "/.slurm"); /* $HOME/.slurm/ */
search_paths[2] = "/usr/share/slurm"; /* Debian style */
search_paths[3] = "/usr/local/share/slurm"; /* default install path */
search_paths[4] = "/usr/pkg/share/slurm"; /* NetBSD style */
search_paths[2] = strcat(pref, "/share/slurm"); /* search in $PREFIX/share/slurm/ */

for (iter = 0; iter <= 4; iter++) {
for (iter = 0; iter <= 2; iter++) {
bzero(&filename, BUFSIZ);
snprintf(filename, BUFSIZ, "%s/%s.theme", search_paths[iter],
name);
Expand Down

0 comments on commit 58655d7

Please sign in to comment.