#include <fileserver.h>
Public Member Functions | |
FileServer (const char *id) | |
virtual | ~FileServer () |
bool | SetAssign (const string &assign, const string &path) |
const char * | GetAssign (const string &assign) |
void | ResetAssigns () |
bool | ManglePath (const string &path, string &full_path) |
Directory * | NewDirectory () const |
File * | NewFile () const |
bool | IsStandartStream (const File *file) const |
bool | FileExists (const string &path) const |
bool | DirectoryExists (const string &path) const |
bool | CopyFileEx (const string &from, const string &to) |
bool | Checksum (const string &file_name, uint_t &crc) |
bool | CreatePath (const string &path) |
bool | DeleteFileEx (const string &file_name) |
bool | DeleteDirectory (const string &dir_name) |
bool | ListFiles (vector< string > &file_list, const string &dir_name) |
bool | ListDirectories (vector< string > &file_list, const string &dir_name, bool special=false) |
Static Public Member Functions | |
static void | CleanupPath (string &path) |
static void | ExtractDirectory (const string &path, string &dir) |
static void | ExtractFile (const string &path, string &file) |
static void | ExtractFileName (const string &path, string &file_name) |
static void | ExtractExtension (const string &path, string &extension) |
static File * | GetStdIn () |
static File * | GetStdOut () |
static File * | GetStdErr () |
Protected Member Functions | |
void | InitAssigns () |
void | InitAppAssign () |
void | InitUserAssign () |
Protected Attributes | |
Root * | assigns |
Static Protected Attributes | |
static File | std_in |
static File | std_out |
static File | std_err |
FileServer::FileServer | ( | const char * | id | ) |
Constructor.
FileServer::~FileServer | ( | ) | [virtual] |
Destructor.
bool FileServer::SetAssign | ( | const string & | assign, | |
const string & | path | |||
) |
Creates new or modifies existing assign under /sys/assigns.
assign | The name of the assign. | |
path | The path to which the assign links. |
const char * FileServer::GetAssign | ( | const string & | assign | ) |
Queries existing assign under /sys/assigns.
assign | The name of the assign. |
void FileServer::ResetAssigns | ( | ) |
Remove all existing assigns and setup base assigns.
bool FileServer::ManglePath | ( | const string & | path, | |
string & | full_path | |||
) |
Expands assign in path to full absolute path, replaces any backslashes by slashes, removes any trailing slash, and makes the path absolute.
path | The path to expand. | |
full_path | Expanded path. |
True
if successful. void FileServer::CleanupPath | ( | string & | path | ) | [static] |
Returns a cleaned up path name (replaces backslashes with slashes, and removes trailing slash if exists.
void FileServer::ExtractDirectory | ( | const string & | path, | |
string & | dir | |||
) | [static] |
void FileServer::ExtractFile | ( | const string & | path, | |
string & | file | |||
) | [static] |
void FileServer::ExtractFileName | ( | const string & | path, | |
string & | file_name | |||
) | [static] |
void FileServer::ExtractExtension | ( | const string & | path, | |
string & | extension | |||
) | [static] |
Directory * FileServer::NewDirectory | ( | ) | const [inline] |
File * FileServer::GetStdIn | ( | ) | [inline, static] |
Returns wrapper of standart input.
File * FileServer::GetStdOut | ( | ) | [inline, static] |
Returns wrapper of standart output.
File * FileServer::GetStdErr | ( | ) | [inline, static] |
Returns wrapper of standart error output.
bool FileServer::IsStandartStream | ( | const File * | file | ) | const [inline] |
Check if given file is a wrapper of standart stream.
True
if file is a wrapper of standart stream. bool FileServer::FileExists | ( | const string & | path | ) | const |
Check if file exists.
bool FileServer::DirectoryExists | ( | const string & | path | ) | const |
Check if directory exists.
bool FileServer::CopyFileEx | ( | const string & | from, | |
const string & | to | |||
) |
bool FileServer::Checksum | ( | const string & | file_name, | |
uint_t & | crc | |||
) |
bool FileServer::CreatePath | ( | const string & | path | ) |
bool FileServer::DeleteFileEx | ( | const string & | file_name | ) |
bool FileServer::DeleteDirectory | ( | const string & | dir_name | ) |
bool FileServer::ListFiles | ( | vector< string > & | file_list, | |
const string & | dir_name | |||
) |
bool FileServer::ListDirectories | ( | vector< string > & | file_list, | |
const string & | dir_name, | |||
bool | special = false | |||
) |
void FileServer::InitAssigns | ( | ) | [protected] |
Initializes all default assigns.
void FileServer::InitAppAssign | ( | ) | [protected] |
Initialize home directory assign ("home:").
void FileServer::InitUserAssign | ( | ) | [protected] |
Initialize the user assign. This is where the application should save any type of data, like save games or config options, since applications may not have write access to the home: directory (which is by tradition the application directory).
Root* FileServer::assigns [protected] |
File FileServer::std_in [static, protected] |
File FileServer::std_out [static, protected] |
File FileServer::std_err [static, protected] |