openMSX
Namespaces | Macros | Functions
FileOperations.cc File Reference
#include <sys/types.h>
#include <pwd.h>
#include <climits>
#include <unistd.h>
#include "openmsx.hh"
#include "systemfuncs.hh"
#include <ftw.h>
#include "ReadDir.hh"
#include "FileOperations.hh"
#include "FileException.hh"
#include "StringOp.hh"
#include "statp.hh"
#include "unistdp.hh"
#include "countof.hh"
#include "build-info.hh"
#include "AndroidApiWrapper.hh"
#include <sstream>
#include <cerrno>
#include <cstdlib>
#include <cassert>
#include <dirent.h>
Include dependency graph for FileOperations.cc:

Go to the source code of this file.

Namespaces

 openmsx
 Thanks to enen for testing this on a real cartridge:
 
 openmsx::FileOperations
 

Macros

#define MAXPATHLEN   4096
 

Functions

string openmsx::FileOperations::expandTilde (string_ref path)
 Expand the '~' character to the users home directory. More...
 
void openmsx::FileOperations::mkdir (const std::string &path, mode_t mode)
 Create the specified directory. More...
 
void openmsx::FileOperations::mkdirp (string_ref path)
 Acts like the unix command "mkdir -p". More...
 
int openmsx::FileOperations::unlink (const std::string &path)
 Call unlink() in a platform-independent manner. More...
 
int openmsx::FileOperations::rmdir (const std::string &path)
 Call rmdir() in a platform-independent manner. More...
 
int openmsx::FileOperations::deleteRecursive_cb (const char *fpath, const struct stat *, int, struct FTW *)
 
int openmsx::FileOperations::deleteRecursive (const std::string &path)
 Recurively delete a file or directory and (in case of a directory) all its sub-components. More...
 
FILE * openmsx::FileOperations::openFile (const std::string &filename, const std::string &mode)
 Call fopen() in a platform-independent manner. More...
 
void openmsx::FileOperations::openofstream (std::ofstream &stream, const std::string &filename)
 Open an ofstream in a platform-independent manner. More...
 
void openmsx::FileOperations::openofstream (std::ofstream &stream, const std::string &filename, std::ios_base::openmode mode)
 Open an ofstream in a platform-independent manner. More...
 
string_ref openmsx::FileOperations::getFilename (string_ref path)
 Returns the file portion of a path name. More...
 
string_ref openmsx::FileOperations::getBaseName (string_ref path)
 Returns the directory portion of a path. More...
 
string_ref openmsx::FileOperations::getExtension (string_ref path)
 Returns the extension portion of a path. More...
 
string_ref openmsx::FileOperations::stripExtension (string_ref path)
 Returns the path without extension. More...
 
string openmsx::FileOperations::join (string_ref part1, string_ref part2)
 Join two paths. More...
 
string openmsx::FileOperations::join (string_ref part1, string_ref part2, string_ref part3)
 
string openmsx::FileOperations::join (string_ref part1, string_ref part2, string_ref part3, string_ref part4)
 
string openmsx::FileOperations::getNativePath (string_ref path)
 Returns the path in native path-delimiter. More...
 
string openmsx::FileOperations::getConventionalPath (string_ref path)
 Returns the path in conventional path-delimiter. More...
 
string openmsx::FileOperations::getCurrentWorkingDirectory ()
 Returns the current working directory. More...
 
string openmsx::FileOperations::getAbsolutePath (string_ref path)
 Transform given path into an absolute path. More...
 
bool openmsx::FileOperations::isAbsolutePath (string_ref path)
 Checks whether it's a absolute path or not. More...
 
string openmsx::FileOperations::getUserHomeDir (string_ref username)
 Get user's home directory. More...
 
const string & openmsx::FileOperations::getUserOpenMSXDir ()
 Get the openMSX dir in the user's home directory. More...
 
string openmsx::FileOperations::getUserDataDir ()
 Get the openMSX data dir in the user's home directory. More...
 
string openmsx::FileOperations::getSystemDataDir ()
 Get system directory. More...
 
string openmsx::FileOperations::expandCurrentDirFromDrive (string_ref path)
 Get the current directory of the specified drive Linux: just return an empty string. More...
 
bool openmsx::FileOperations::getStat (const std::string &filename, Stat &st)
 Call stat() and return the stat structure. More...
 
bool openmsx::FileOperations::isRegularFile (const Stat &st)
 
bool openmsx::FileOperations::isRegularFile (const std::string &filename)
 Is this a regular file (no directory, device, ..)? More...
 
bool openmsx::FileOperations::isDirectory (const Stat &st)
 
bool openmsx::FileOperations::isDirectory (const std::string &directory)
 Is this a directory? More...
 
bool openmsx::FileOperations::exists (const std::string &filename)
 Does this file (directory) exists? More...
 
time_t openmsx::FileOperations::getModificationDate (const Stat &st)
 Get the date/time of last modification. More...
 
string openmsx::FileOperations::getNextNumberedFileName (string_ref directory, string_ref prefix, string_ref extension)
 Gets the next numbered file name with the specified prefix in the specified directory, with the specified extension. More...
 
string openmsx::FileOperations::parseCommandFileArgument (string_ref argument, string_ref directory, string_ref prefix, string_ref extension)
 Helper function for parsing filename arguments in Tcl commands. More...
 
string openmsx::FileOperations::getTempDir ()
 Get the name of the temp directory on the system. More...
 
FILE * openmsx::FileOperations::openUniqueFile (const std::string &directory, std::string &filename)
 Open a new file with a unique name in the provided directory. More...
 

Macro Definition Documentation

#define MAXPATHLEN   4096