openMSX
Classes | Namespaces | Typedefs | Functions | Variables
FileOperations.hh File Reference
#include "unistdp.hh"
#include "statp.hh"
#include <sys/types.h>
#include <fstream>
#include <memory>
#include <string_view>
Include dependency graph for FileOperations.hh:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  openmsx::FileOperations::FClose
 

Namespaces

 openmsx::FileOperations
 

Typedefs

using openmsx::FileOperations::FILE_t = std::unique_ptr< FILE, FClose >
 
using openmsx::FileOperations::Stat = struct stat
 

Functions

std::string openmsx::FileOperations::expandTilde (std::string_view 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 (std::string_view 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 (const std::string &path)
 Recurively delete a file or directory and (in case of a directory) all its sub-components. More...
 
FILE_t 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...
 
std::string_view openmsx::FileOperations::getFilename (std::string_view path)
 Returns the file portion of a path name. More...
 
std::string_view openmsx::FileOperations::getDirName (std::string_view path)
 Returns the directory portion of a path. More...
 
std::string_view openmsx::FileOperations::getExtension (std::string_view path)
 Returns the extension portion of a path. More...
 
std::string_view openmsx::FileOperations::stripExtension (std::string_view path)
 Returns the path without extension. More...
 
std::string openmsx::FileOperations::join (std::string_view part1, std::string_view part2)
 Join two paths. More...
 
std::string openmsx::FileOperations::join (std::string_view part1, std::string_view part2, std::string_view part3)
 
std::string openmsx::FileOperations::join (std::string_view part1, std::string_view part2, std::string_view part3, std::string_view part4)
 
std::string openmsx::FileOperations::getConventionalPath (std::string_view path)
 Returns the path in conventional path-delimiter. More...
 
std::string openmsx::FileOperations::getNativePath (std::string_view path)
 Returns the path in native path-delimiter. More...
 
string openmsx::FileOperations::getCurrentWorkingDirectory ()
 Returns the current working directory. More...
 
std::string openmsx::FileOperations::getAbsolutePath (std::string_view path)
 Transform given path into an absolute path. More...
 
bool openmsx::FileOperations::isAbsolutePath (std::string_view path)
 Checks whether it's a absolute path or not. More...
 
std::string openmsx::FileOperations::getUserHomeDir (std::string_view 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...
 
std::string openmsx::FileOperations::expandCurrentDirFromDrive (std::string_view path)
 Get the current directory of the specified drive Linux: just return an empty string. More...
 
bool openmsx::FileOperations::getStat (std::string_view filename, Stat &st)
 Call stat() and return the stat structure. More...
 
bool openmsx::FileOperations::isRegularFile (std::string_view filename)
 Is this a regular file (no directory, device, ..)? More...
 
bool openmsx::FileOperations::isRegularFile (const Stat &st)
 
bool openmsx::FileOperations::isDirectory (std::string_view directory)
 Is this a directory? More...
 
bool openmsx::FileOperations::isDirectory (const Stat &st)
 
bool openmsx::FileOperations::exists (std::string_view filename)
 Does this file (directory) exists? More...
 
time_t openmsx::FileOperations::getModificationDate (const Stat &st)
 Get the date/time of last modification. More...
 
std::string openmsx::FileOperations::getNextNumberedFileName (std::string_view directory, std::string_view prefix, std::string_view extension)
 Gets the next numbered file name with the specified prefix in the specified directory, with the specified extension. More...
 
std::string openmsx::FileOperations::parseCommandFileArgument (std::string_view argument, std::string_view directory, std::string_view prefix, std::string_view 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_t openmsx::FileOperations::openUniqueFile (const std::string &directory, std::string &filename)
 Open a new file with a unique name in the provided directory. More...
 

Variables

const char openmsx::FileOperations::nativePathSeparator