openMSX
Namespaces | Macros | Functions
FileOperations.cc File Reference
#include <sys/types.h>
#include <pwd.h>
#include <climits>
#include <unistd.h>
#include "systemfuncs.hh"
#include <ftw.h>
#include "openmsx.hh"
#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

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

Macros

#define MAXPATHLEN   4096

Functions

string openmsx::FileOperations::expandTilde (string_ref path)
 Expand the '~' character to the users home directory.
void openmsx::FileOperations::mkdir (const std::string &path, mode_t mode)
 Create the specified directory.
void openmsx::FileOperations::mkdirp (string_ref path)
 Acts like the unix command "mkdir -p".
int openmsx::FileOperations::unlink (const std::string &path)
 Call unlink() in a platform-independent manner.
int openmsx::FileOperations::rmdir (const std::string &path)
 Call rmdir() in a platform-independent manner.
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.
FILE * openmsx::FileOperations::openFile (const std::string &filename, const std::string &mode)
 Call fopen() in a platform-independent manner.
void openmsx::FileOperations::openofstream (std::ofstream &stream, const std::string &filename)
 Open an ofstream in a platform-independent manner.
void openmsx::FileOperations::openofstream (std::ofstream &stream, const std::string &filename, std::ios_base::openmode mode)
 Open an ofstream in a platform-independent manner.
string_ref openmsx::FileOperations::getFilename (string_ref path)
 Returns the file portion of a path name.
string_ref openmsx::FileOperations::getBaseName (string_ref path)
 Returns the directory portion of a path.
string_ref openmsx::FileOperations::getExtension (string_ref path)
 Returns the extension portion of a path.
string_ref openmsx::FileOperations::stripExtension (string_ref path)
 Returns the path without extension.
string openmsx::FileOperations::join (string_ref part1, string_ref part2)
 Join two paths.
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.
string openmsx::FileOperations::getConventionalPath (string_ref path)
 Returns the path in conventional path-delimiter.
string openmsx::FileOperations::getCurrentWorkingDirectory ()
 Returns the current working directory.
string openmsx::FileOperations::getAbsolutePath (string_ref path)
 Transform given path into an absolute path.
bool openmsx::FileOperations::isAbsolutePath (string_ref path)
 Checks whether it's a absolute path or not.
string openmsx::FileOperations::getUserHomeDir (string_ref username)
 Get user's home directory.
const string & openmsx::FileOperations::getUserOpenMSXDir ()
 Get the openMSX dir in the user's home directory.
string openmsx::FileOperations::getUserDataDir ()
 Get the openMSX data dir in the user's home directory.
string openmsx::FileOperations::getSystemDataDir ()
 Get system directory.
string openmsx::FileOperations::expandCurrentDirFromDrive (string_ref path)
 Get the current directory of the specified drive Linux: just return an empty string.
bool openmsx::FileOperations::getStat (const std::string &filename, Stat &st)
 Call stat() and return the stat structure.
bool openmsx::FileOperations::isRegularFile (const Stat &st)
bool openmsx::FileOperations::isRegularFile (const std::string &filename)
 Is this a regular file (no directory, device, ..)?
bool openmsx::FileOperations::isDirectory (const Stat &st)
bool openmsx::FileOperations::isDirectory (const std::string &directory)
 Is this a directory?
bool openmsx::FileOperations::exists (const std::string &filename)
 Does this file (directory) exists?
time_t openmsx::FileOperations::getModificationDate (const Stat &st)
 Get the date/time of last modification.
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.
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.
string openmsx::FileOperations::getTempDir ()
 Get the name of the temp directory on the system.
FILE * openmsx::FileOperations::openUniqueFile (const std::string &directory, std::string &filename)
 Open a new file with a unique name in the provided directory.

Macro Definition Documentation

#define MAXPATHLEN   4096