libsaria: Rip out old library
The code was a bit messy and didn't make use of namespaces very well. By converting to a set of functions (instead of a class) I can use each function as a function pointer if I want to. I am also able to remove libsaria/library.cpp since this was just a set of wrapper functions to the old static class functions.
This commit is contained in:
parent
1b18069b77
commit
a508b7ff72
|
@ -9,12 +9,16 @@ using namespace std;
|
||||||
|
|
||||||
namespace libsaria
|
namespace libsaria
|
||||||
{
|
{
|
||||||
void add_library(string);
|
namespace library
|
||||||
void refresh_library();
|
{
|
||||||
void library_list(list<Track> &);
|
void load();
|
||||||
void play_id(ino_t);
|
void save();
|
||||||
void library_save();
|
void refresh();
|
||||||
void library_load();
|
|
||||||
|
void add_path(string);
|
||||||
|
void play_id(ino_t);
|
||||||
|
void for_each(void (*)(Track &));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* LIBSARIA_LIBRARY_H */
|
#endif /* LIBSARIA_LIBRARY_H */
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define LIBSARIA_PATH_H
|
#define LIBSARIA_PATH_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <list>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -13,7 +13,7 @@ struct file
|
||||||
ino_t d_ino;
|
ino_t d_ino;
|
||||||
};
|
};
|
||||||
|
|
||||||
void readdir(string, vector<file> &, vector<file> &);
|
void readdir(string, list<file> &, list<file> &);
|
||||||
string get_saria_dir();
|
string get_saria_dir();
|
||||||
void make_saria_dir();
|
void make_saria_dir();
|
||||||
|
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
|
|
||||||
#include "library/library.h"
|
|
||||||
#include <libsaria/library.h>
|
|
||||||
#include <libsaria/callback.h>
|
|
||||||
#include <libsaria/track.h>
|
|
||||||
|
|
||||||
#include <list>
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
static Library library;
|
|
||||||
|
|
||||||
void libsaria::add_library(string dir)
|
|
||||||
{
|
|
||||||
library.add_path(dir);
|
|
||||||
library.update_path(dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
void libsaria::refresh_library()
|
|
||||||
{
|
|
||||||
trigger_callback(LIBRARY_REFRESH);
|
|
||||||
}
|
|
||||||
|
|
||||||
void libsaria::library_list(list<Track> &track_list)
|
|
||||||
{
|
|
||||||
library.list_all(track_list);
|
|
||||||
}
|
|
||||||
|
|
||||||
void libsaria::play_id(ino_t inode)
|
|
||||||
{
|
|
||||||
library.play_id(inode);
|
|
||||||
}
|
|
||||||
|
|
||||||
void libsaria::library_save()
|
|
||||||
{
|
|
||||||
library.save();
|
|
||||||
}
|
|
||||||
|
|
||||||
void libsaria::library_load()
|
|
||||||
{
|
|
||||||
library.load();
|
|
||||||
}
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
* Manages the libsaria library save file
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <libsaria/library.h>
|
||||||
|
#include "library.h"
|
||||||
|
|
||||||
|
void LibraryPath::save(OutFile &out)
|
||||||
|
{
|
||||||
|
map<ino_t, TrackTag>::iterator it;
|
||||||
|
|
||||||
|
out.write_str(path, false);
|
||||||
|
out.write_lui(file_map.size(), true);
|
||||||
|
for (it = file_map.begin(); it != file_map.end(); it++) {
|
||||||
|
out.write_ino(it->first, false);
|
||||||
|
it->second.save(out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace libsaria
|
||||||
|
{
|
||||||
|
void library::load()
|
||||||
|
{
|
||||||
|
unsigned int size;
|
||||||
|
string dir;
|
||||||
|
map<string, LibraryPath> *path_map = get_library_map();
|
||||||
|
InFile in("library.lib");
|
||||||
|
|
||||||
|
if (!in.good())
|
||||||
|
return;
|
||||||
|
size = in.read_lui();
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < size; i++) {
|
||||||
|
dir = in.read_str();
|
||||||
|
path_map->insert(
|
||||||
|
pair<string, LibraryPath>(dir, LibraryPath(in, dir))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void library::save()
|
||||||
|
{
|
||||||
|
OutFile out("library.lib");
|
||||||
|
map<string, LibraryPath> *path_map = get_library_map();
|
||||||
|
map<string, LibraryPath>::iterator it;
|
||||||
|
|
||||||
|
out.write_lui(path_map->size(), true);
|
||||||
|
for (it = path_map->begin(); it != path_map->end(); it++)
|
||||||
|
it->second.save(out);
|
||||||
|
}
|
||||||
|
|
||||||
|
}; /* namespace: libsaria */
|
|
@ -1,84 +1,71 @@
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include <libsaria/callback.h>
|
||||||
|
#include <libsaria/controls.h>
|
||||||
#include <libsaria/library.h>
|
#include <libsaria/library.h>
|
||||||
#include "library.h"
|
#include "library.h"
|
||||||
|
|
||||||
Library::Library()
|
static map<string, LibraryPath> path_map;
|
||||||
|
|
||||||
|
map<string, LibraryPath> *get_library_map()
|
||||||
{
|
{
|
||||||
|
return &path_map;
|
||||||
}
|
}
|
||||||
|
|
||||||
Library::~Library()
|
LibraryPath *get_library_path(string dir)
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Library::list_all(list<Track> &track_list)
|
|
||||||
{
|
{
|
||||||
map<string, LibraryPath>::iterator it;
|
map<string, LibraryPath>::iterator it;
|
||||||
for (it = path_map.begin(); it != path_map.end(); it++)
|
it = path_map.find(dir);
|
||||||
it->second.list_all(track_list);
|
if (it != path_map.end())
|
||||||
|
return &it->second;
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Library::play_id(ino_t inode)
|
void LibraryPath::for_each(void (*ins_func)(Track &))
|
||||||
{
|
|
||||||
map<string, LibraryPath>::iterator it;
|
|
||||||
for (it = path_map.begin(); it != path_map.end(); it++) {
|
|
||||||
if (it->second.play_id(inode) == true)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Library::save()
|
|
||||||
{
|
|
||||||
OutFile out("library.lib");
|
|
||||||
map<string, LibraryPath>::iterator it;
|
|
||||||
|
|
||||||
out.write_lui(path_map.size(), true);
|
|
||||||
for (it = path_map.begin(); it != path_map.end(); it++)
|
|
||||||
it->second.save(out);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Library::load()
|
|
||||||
{
|
|
||||||
unsigned int size;
|
|
||||||
string dir;
|
|
||||||
InFile in("library.lib");
|
|
||||||
|
|
||||||
if (!in.good())
|
|
||||||
return;
|
|
||||||
size = in.read_lui();
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < size; i++) {
|
|
||||||
dir = in.read_str();
|
|
||||||
path_map.insert(
|
|
||||||
pair<string, LibraryPath>(dir, LibraryPath(in, dir))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LibraryPath::save(OutFile &out)
|
|
||||||
{
|
{
|
||||||
map<ino_t, TrackTag>::iterator it;
|
map<ino_t, TrackTag>::iterator it;
|
||||||
|
|
||||||
out.write_str(path, false);
|
|
||||||
out.write_lui(file_map.size(), true);
|
|
||||||
for (it = file_map.begin(); it != file_map.end(); it++) {
|
for (it = file_map.begin(); it != file_map.end(); it++) {
|
||||||
out.write_ino(it->first, false);
|
Track track = Track(it->first, &it->second);
|
||||||
it->second.save(out);
|
ins_func(track);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LibraryPath::LibraryPath(InFile &in, string dir)
|
bool LibraryPath::play_id(ino_t id)
|
||||||
{
|
{
|
||||||
unsigned int size;
|
map<ino_t, TrackTag>::iterator it;
|
||||||
ino_t inode;
|
it = file_map.find(id);
|
||||||
|
if (it == file_map.end())
|
||||||
path = dir;
|
return false;
|
||||||
size = in.read_lui();
|
libsaria::load(it->second.get_filepath());
|
||||||
println("Library path dir: " + path);
|
return true;
|
||||||
print("Library path size: ");
|
|
||||||
println(size);
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < size; i++) {
|
|
||||||
inode = in.read_ino();
|
|
||||||
file_map[inode] = TrackTag(in);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace libsaria
|
||||||
|
{
|
||||||
|
|
||||||
|
void library::for_each(void (*ins_func)(Track &))
|
||||||
|
{
|
||||||
|
map<string, LibraryPath>::iterator it;
|
||||||
|
for (it = path_map.begin(); it != path_map.end(); it++)
|
||||||
|
it->second.for_each(ins_func);
|
||||||
|
}
|
||||||
|
|
||||||
|
void library::play_id(ino_t id)
|
||||||
|
{
|
||||||
|
map<string, LibraryPath>::iterator it;
|
||||||
|
for (it = path_map.begin(); it != path_map.end(); it++) {
|
||||||
|
if (it->second.play_id(id) == true)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void library::refresh()
|
||||||
|
{
|
||||||
|
trigger_callback(LIBRARY_REFRESH);
|
||||||
|
}
|
||||||
|
|
||||||
|
}; /* namespace: libsaria */
|
||||||
|
|
|
@ -3,27 +3,44 @@
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include <libsaria/track.h>
|
#include <libsaria/path.h>
|
||||||
#include "path.h"
|
|
||||||
|
|
||||||
class Library
|
class LibraryPath
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
map<string, LibraryPath> path_map;
|
string path;
|
||||||
|
map <ino_t, TrackTag> file_map;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Library();
|
LibraryPath(string);
|
||||||
~Library();
|
LibraryPath(InFile &, string);
|
||||||
|
~LibraryPath();
|
||||||
|
|
||||||
void add_path(string);
|
void for_each(void (*)(Track &));
|
||||||
void update_path(string);
|
void insert_track(ino_t, TrackTag &);
|
||||||
void list_all(list<Track> &);
|
bool play_id(ino_t);
|
||||||
void play_id(ino_t);
|
void save(OutFile &);
|
||||||
void save();
|
void update();
|
||||||
void load();
|
unsigned int size();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ScanTask : public IdleTask
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
LibraryPath *library;
|
||||||
|
string dir;
|
||||||
|
bool end_dir;
|
||||||
|
void tag_file(file);
|
||||||
|
|
||||||
|
public:
|
||||||
|
ScanTask(LibraryPath *, string, bool);
|
||||||
|
~ScanTask();
|
||||||
|
void run_task();
|
||||||
|
};
|
||||||
|
|
||||||
|
map<string, LibraryPath> *get_library_map();
|
||||||
|
LibraryPath *get_library_path(string);
|
||||||
|
|
||||||
#endif /* LIBSARIA_LIBRARY_SOURCE_H */
|
#endif /* LIBSARIA_LIBRARY_SOURCE_H */
|
||||||
|
|
|
@ -1,40 +1,132 @@
|
||||||
|
|
||||||
#include <libsaria/controls.h>
|
#include <string>
|
||||||
#include "path.h"
|
using namespace std;
|
||||||
|
|
||||||
|
#include <libsaria/tags.h>
|
||||||
|
#include <libsaria/library.h>
|
||||||
|
#include "library.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Definitions for the LibraryPath class
|
||||||
|
*/
|
||||||
LibraryPath::LibraryPath(string dir)
|
LibraryPath::LibraryPath(string dir)
|
||||||
{
|
{
|
||||||
path = dir;
|
path = dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LibraryPath::LibraryPath(InFile &in, string dir)
|
||||||
|
{
|
||||||
|
unsigned int size;
|
||||||
|
ino_t inode;
|
||||||
|
|
||||||
|
path = dir;
|
||||||
|
size = in.read_lui();
|
||||||
|
println("Library path dir: " + path);
|
||||||
|
print("Library path size: ");
|
||||||
|
println(size);
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < size; i++) {
|
||||||
|
inode = in.read_ino();
|
||||||
|
file_map[inode] = TrackTag(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
LibraryPath::~LibraryPath()
|
LibraryPath::~LibraryPath()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LibraryPath::insert_track(ino_t inode, TrackTag &tag)
|
||||||
|
{
|
||||||
|
file_map[inode] = tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LibraryPath::update()
|
||||||
|
{
|
||||||
|
ScanTask *task = new ScanTask(this, path, false);
|
||||||
|
libsaria::queue_task(task);
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int LibraryPath::size()
|
unsigned int LibraryPath::size()
|
||||||
{
|
{
|
||||||
return file_map.size();
|
return file_map.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
string LibraryPath::get_path()
|
|
||||||
|
/*
|
||||||
|
* Definitions for the ScanTask class
|
||||||
|
*/
|
||||||
|
ScanTask::ScanTask(LibraryPath *lib_path, string scan_dir, bool end)
|
||||||
{
|
{
|
||||||
return path;
|
library = lib_path;
|
||||||
|
dir = scan_dir;
|
||||||
|
end_dir = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibraryPath::list_all(list<Track> &track_list)
|
ScanTask::~ScanTask()
|
||||||
|
{}
|
||||||
|
|
||||||
|
void ScanTask::tag_file(file filepath)
|
||||||
{
|
{
|
||||||
map<ino_t, TrackTag>::iterator it;
|
try {
|
||||||
for (it = file_map.begin(); it != file_map.end(); it++) {
|
TrackTag tag(dir + "/" + filepath.name);
|
||||||
track_list.push_back(Track(it->first, &it->second));
|
library->insert_track(filepath.d_ino, tag);
|
||||||
|
} catch (string message) {
|
||||||
|
println(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LibraryPath::play_id(ino_t inode)
|
/*
|
||||||
|
* 1) Read a directory
|
||||||
|
* 2) Find tags for each music file
|
||||||
|
* 3) Create and queue a new ScanTask for each subdirectory
|
||||||
|
*/
|
||||||
|
void ScanTask::run_task()
|
||||||
{
|
{
|
||||||
map<ino_t, TrackTag>::iterator iter;
|
int last, i = 0;
|
||||||
iter = file_map.find(inode);
|
list<file> files;
|
||||||
if (iter == file_map.end())
|
list<file> dirs;
|
||||||
return false;
|
list<file>::iterator it;
|
||||||
libsaria::load(iter->second.get_filepath());
|
ScanTask *scan;
|
||||||
return true;
|
SaveTask *save;
|
||||||
|
|
||||||
|
readdir(dir, files, dirs);
|
||||||
|
|
||||||
|
for (it = files.begin(); it != files.end(); it++)
|
||||||
|
tag_file(*it);
|
||||||
|
|
||||||
|
last = dirs.size() - 1;
|
||||||
|
for (it = dirs.begin(); it != dirs.end(); it++) {
|
||||||
|
scan = new ScanTask(library, dir + "/" + (*it).name, i == last);
|
||||||
|
libsaria::queue_task(scan);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (end_dir == true) {
|
||||||
|
print("Library path size: ");
|
||||||
|
println(library->size());
|
||||||
|
save = new SaveTask(libsaria::library::save);
|
||||||
|
libsaria::queue_task_front(save);
|
||||||
|
libsaria::library::refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Other functions related to updating the library
|
||||||
|
*/
|
||||||
|
static void update_path(string dir)
|
||||||
|
{
|
||||||
|
get_library_path(dir)->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace libsaria
|
||||||
|
{
|
||||||
|
void library::add_path(string dir)
|
||||||
|
{
|
||||||
|
get_library_map()->insert(
|
||||||
|
pair<string, LibraryPath>(dir, LibraryPath(dir))
|
||||||
|
);
|
||||||
|
update_path(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
}; /* Namespace: libsaria */
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
#ifndef LIBSARIA_LIBRARY_PATH_H
|
|
||||||
#define LIBSARIA_LIBRARY_PATH_H
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <list>
|
|
||||||
#include <map>
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
#include <libsaria/path.h>
|
|
||||||
#include <libsaria/idle.h>
|
|
||||||
#include <libsaria/tags.h>
|
|
||||||
#include <libsaria/track.h>
|
|
||||||
#include <libsaria/files.h>
|
|
||||||
|
|
||||||
class LibraryPath
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
string path;
|
|
||||||
map <ino_t, TrackTag> file_map;
|
|
||||||
|
|
||||||
public:
|
|
||||||
LibraryPath(string);
|
|
||||||
LibraryPath(InFile &, string);
|
|
||||||
~LibraryPath();
|
|
||||||
|
|
||||||
void update();
|
|
||||||
string get_path();
|
|
||||||
void insert_track(ino_t, TrackTag &);
|
|
||||||
unsigned int size();
|
|
||||||
void list_all(list<Track> &track_list);
|
|
||||||
bool play_id(ino_t);
|
|
||||||
void save(OutFile &);
|
|
||||||
};
|
|
||||||
|
|
||||||
class ScanTask : public IdleTask
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
LibraryPath *library;
|
|
||||||
string dir;
|
|
||||||
bool end_dir;
|
|
||||||
void tag_file(file);
|
|
||||||
|
|
||||||
public:
|
|
||||||
ScanTask(LibraryPath *, string, bool);
|
|
||||||
~ScanTask();
|
|
||||||
void run_task();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* LIBSARIA_LIBRARY_PATH_H */
|
|
|
@ -1,91 +0,0 @@
|
||||||
|
|
||||||
#include <libsaria/print.h>
|
|
||||||
#include <libsaria/idle.h>
|
|
||||||
#include <libsaria/path.h>
|
|
||||||
#include <libsaria/tags.h>
|
|
||||||
#include <libsaria/files.h>
|
|
||||||
#include <libsaria/library.h>
|
|
||||||
|
|
||||||
#include "library.h"
|
|
||||||
#include "path.h"
|
|
||||||
|
|
||||||
static void queue_dir_scan(LibraryPath *lib_path, string scan_dir, bool end)
|
|
||||||
{
|
|
||||||
ScanTask *task = new ScanTask(lib_path, scan_dir, end);
|
|
||||||
libsaria::queue_task(task);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void queue_lib_save()
|
|
||||||
{
|
|
||||||
SaveTask *task = new SaveTask(libsaria::library_save);
|
|
||||||
libsaria::queue_task_front(task);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Library::add_path(string dir)
|
|
||||||
{
|
|
||||||
path_map.insert( pair<string, LibraryPath>(dir, LibraryPath(dir)) );
|
|
||||||
}
|
|
||||||
|
|
||||||
void Library::update_path(string dir)
|
|
||||||
{
|
|
||||||
map<string, LibraryPath>::iterator it;
|
|
||||||
it = path_map.find(dir);
|
|
||||||
if (it != path_map.end())
|
|
||||||
it->second.update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void LibraryPath::insert_track(ino_t inode, TrackTag & tag)
|
|
||||||
{
|
|
||||||
file_map[inode] = tag;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LibraryPath::update()
|
|
||||||
{
|
|
||||||
queue_dir_scan(this, path, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
ScanTask::ScanTask(LibraryPath *lib_path, string scan_dir, bool end)
|
|
||||||
{
|
|
||||||
library = lib_path;
|
|
||||||
dir = scan_dir;
|
|
||||||
end_dir = end;
|
|
||||||
}
|
|
||||||
|
|
||||||
ScanTask::~ScanTask()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScanTask::tag_file(file filepath)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
TrackTag tag(dir + "/" + filepath.name);
|
|
||||||
library->insert_track(filepath.d_ino, tag);
|
|
||||||
} catch (string message) {
|
|
||||||
println(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 1) Read a directory
|
|
||||||
* 2) Create and queue a new UpdateTask for each subdirectory
|
|
||||||
* 3) Find tags for each music file
|
|
||||||
*/
|
|
||||||
void ScanTask::run_task()
|
|
||||||
{
|
|
||||||
vector<file> files;
|
|
||||||
vector<file> dirs;
|
|
||||||
readdir(dir, files, dirs);
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < files.size(); i++)
|
|
||||||
tag_file(files[i]);
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < dirs.size(); i++)
|
|
||||||
queue_dir_scan(library, dir + "/" + dirs[i].name, i == dirs.size() - 1);
|
|
||||||
|
|
||||||
if (end_dir == true) {
|
|
||||||
print("Library path size: ");
|
|
||||||
println(library->size());
|
|
||||||
libsaria::refresh_library();
|
|
||||||
queue_lib_save();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -12,7 +12,7 @@ void libsaria::init(int argc, char **argv)
|
||||||
print("saria dir: ");
|
print("saria dir: ");
|
||||||
println(get_saria_dir());
|
println(get_saria_dir());
|
||||||
make_saria_dir();
|
make_saria_dir();
|
||||||
libsaria::library_load();
|
libsaria::library::load();
|
||||||
}
|
}
|
||||||
|
|
||||||
void libsaria::quit()
|
void libsaria::quit()
|
||||||
|
|
|
@ -12,7 +12,7 @@ using namespace std;
|
||||||
#define __USE_BSD
|
#define __USE_BSD
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void sort_entry(struct dirent *dirp, vector<file> &files, vector<file> &dirs)
|
static void sort_entry(struct dirent *dirp, list<file> &files, list<file> &dirs)
|
||||||
{
|
{
|
||||||
struct file entry;
|
struct file entry;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ static void sort_entry(struct dirent *dirp, vector<file> &files, vector<file> &d
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void readdir(string dir, vector<file> &files, vector<file> &dirs)
|
void readdir(string dir, list<file> &files, list<file> &dirs)
|
||||||
{
|
{
|
||||||
DIR *dp;
|
DIR *dp;
|
||||||
struct dirent *dirp;
|
struct dirent *dirp;
|
||||||
|
|
Loading…
Reference in New Issue