Fixed way of determining pipe by XDG_RUNTIME_DIR.
This commit is contained in:
parent
8030e27c8e
commit
619b415d29
|
@ -3,7 +3,7 @@ PREFIX = /usr/local
|
|||
MANPREFIX = $(PREFIX)/share/man
|
||||
|
||||
# Name of program
|
||||
VERSION = 1.3.0
|
||||
VERSION = 1.3.1
|
||||
NAME = pipeplayer
|
||||
|
||||
# Compiler
|
||||
|
|
|
@ -29,13 +29,15 @@ main(int argc, char *argv[])
|
|||
switch (argc) {
|
||||
// Path is provided
|
||||
case 2:
|
||||
pipe = argv[1];
|
||||
pipe = strdup(argv[1]);
|
||||
break;
|
||||
|
||||
// If no arguments provided, pipe = $XDG_RUNTIME_DIR/pipeplayer
|
||||
case 1:
|
||||
if ((xdg_runtime_dir = getenv("XDG_RUNTIME_DIR")) != NULL) {
|
||||
pipe = strcat(xdg_runtime_dir, "/pipeplayer");
|
||||
pipe = malloc(strlen(xdg_runtime_dir) + 12); // Plus length of "/pipeplayer" plus "\0"
|
||||
strcpy(pipe, xdg_runtime_dir);
|
||||
strcat(pipe, "/pipeplayer");
|
||||
break;
|
||||
}
|
||||
puts("XDG_RUNTIME_DIR variable must be set or path to fifo must be specified");
|
||||
|
@ -78,6 +80,7 @@ main(int argc, char *argv[])
|
|||
// Clear player and playlist
|
||||
free_player(player_ptr);
|
||||
free_playlist(playlist_ptr);
|
||||
free(pipe);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue