libsaria: Remove path/

This was old code that had been replaced by fs.cpp months ago.  I must
have forgotten about removing the rest of it...

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-09-12 08:27:06 -04:00
parent 258875bdb8
commit 0d2191da13
3 changed files with 2 additions and 114 deletions

View File

@ -1,26 +0,0 @@
#ifndef LIBSARIA_PATH_H
#define LIBSARIA_PATH_H
#include <track.h>
#include <string>
#include <list>
using namespace std;
#include <sys/types.h>
struct file
{
string name;
// sid_t d_sid;
};
string get_saria_dir();
void make_saria_dir();
bool exists(string);
void remove_file(string);
//sid_t lookup_songid(string &);
string open_pipe(string);
void close_pipes();
#endif /* LIBSARIA_PATH_H */

View File

@ -2,7 +2,7 @@
#include <notify.h>
#include <audio.h>
#include <print.h>
#include <path.h>
#include <fs.h>
#include "audio.h"
static GstState cur_state = GST_STATE_READY;
@ -33,7 +33,7 @@ static bool change_state(GstState new_state)
void load_file(GstElement *playbin, string file, GstState state)
{
if (file == "" || !exists(file))
if (file == "" || !libsaria::exists(file))
return;
string uri = "file://" + file;

View File

@ -1,86 +0,0 @@
// Copyright (c) 2011 Bryan Schumaker.
#include <dirent.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <path.h>
#include <unistd.h>
#include <iostream>
#include <list>
using namespace std;
/* I want to use the d_type field in a dirent */
#ifndef __USE_BSD
#define __USE_BSD
#endif
#ifdef DEBUG
static string SARIA_DIR = "/saria-debug";
#else /* DEBUG */
static string SARIA_DIR = "/saria";
#endif /* DEBUG */
string get_saria_env(const char *env_name, string default_env)
{
char *result = getenv(env_name);
if (result)
return string(result);
return default_env;
}
string get_saria_dir()
{
string saria = get_saria_env("HOME", "~");
string xdg = get_saria_env("XDG_CONFIG_HOME", saria + "/.config");
return xdg + SARIA_DIR;
}
void make_saria_dir()
{
string saria = get_saria_dir();
mode_t mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
mkdir(saria.c_str(), mode);
}
bool exists(string path)
{
struct stat stat;
return lstat(path.c_str(), &stat) == 0;
}
void remove_file(string filename)
{
/*string path = get_saria_dir() + "/" + filename;
if (exists(path))
remove(path.c_str());*/
}
/*sid_t lookup_songid(string &filepath)
{
struct stat stat;
int err = lstat(filepath.c_str(), &stat);
if (err != 0)
return err;
return stat.st_ino;
}*/
static list<string> open_pipes;
string open_pipe(string filename)
{
string file = get_saria_dir() + "/" + filename;
if (!exists(file)) {
open_pipes.push_back(file);
mkfifo(file.c_str(), 0644);
}
return file;
}
void close_pipes()
{
list<string>::iterator it;
/*for (it = open_pipes.begin(); it != open_pipes.end(); it++)
unlink((*it).c_str());*/
}