libsaria: Get the path to the pipe file

This will either return the full path to the file or an empty string if
no pipe has been created.
This commit is contained in:
Bryan Schumaker 2012-01-28 14:10:54 -05:00
parent e1c527c6e7
commit 82b9974448
2 changed files with 11 additions and 0 deletions

View File

@ -19,5 +19,6 @@ string get_saria_dir();
void make_saria_dir();
bool exists(string);
sid_t lookup_songid(string &);
string get_pipe_file();
#endif /* LIBSARIA_PATH_H */

View File

@ -62,3 +62,13 @@ sid_t lookup_songid(string &filepath)
return err;
return stat.st_ino;
}
string get_pipe_file()
{
struct stat stat;
string file = get_saria_dir() + "/saria.pipe";
if (lstat(file.c_str(), &stat) != 0)
return "";
return file;
}