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 "ReadDir.hh"
#include "FileOperations.hh"
#include "FileException.hh"
#include "StringOp.hh"
#include "unistdp.hh"
#include "one_of.hh"
#include "ranges.hh"
#include "strCat.hh"
#include "build-info.hh"
#include <algorithm>
#include <array>
#include <sstream>
#include <cerrno>
#include <cstdlib>
#include <stdexcept>
#include <cassert>
#include <iterator>
#include <dirent.h>
Include dependency graph for FileOperations.cc:

Go to the source code of this file.

Namespaces

namespace  openmsx
 This file implemented 3 utility functions:
 
namespace  openmsx::FileOperations
 

Macros

#define MAXPATHLEN   4096
 

Functions

bool openmsx::FileOperations::needsTildeExpansion (std::string_view path)
 Returns true iff expandTilde(s) would have an effect.
 
string openmsx::FileOperations::expandTilde (std::string path)
 Expand the '~' character to the users home directory.
 
void openmsx::FileOperations::mkdir (zstring_view path, mode_t mode)
 Create the specified directory.
 
void openmsx::FileOperations::mkdirp (std::string path)
 Acts like the unix command "mkdir -p".
 
int openmsx::FileOperations::unlink (zstring_view path)
 Call unlink() in a platform-independent manner.
 
int openmsx::FileOperations::rmdir (zstring_view path)
 Call rmdir() in a platform-independent manner.
 
int openmsx::FileOperations::deleteRecursive (const std::string &path)
 
FILE_t openmsx::FileOperations::openFile (zstring_view filename, zstring_view mode)
 Call fopen() in a platform-independent manner.
 
void openmsx::FileOperations::openOfStream (std::ofstream &stream, zstring_view filename)
 Open an ofstream in a platform-independent manner.
 
void openmsx::FileOperations::openOfStream (std::ofstream &stream, zstring_view filename, std::ios_base::openmode mode)
 Open an ofstream in a platform-independent manner.
 
string_view openmsx::FileOperations::getFilename (std::string_view path)
 Returns the file portion of a path name.
 
string_view openmsx::FileOperations::getDirName (std::string_view path)
 Returns the directory portion of a path.
 
string_view openmsx::FileOperations::getExtension (std::string_view path)
 Returns the extension portion of a path.
 
string_view openmsx::FileOperations::stripExtension (std::string_view path)
 Returns the path without extension.
 
string openmsx::FileOperations::join (std::string_view part1, std::string_view part2)
 Join two paths.
 
string openmsx::FileOperations::join (string_view part1, string_view part2, string_view part3)
 
string openmsx::FileOperations::join (string_view part1, string_view part2, string_view part3, string_view part4)
 
string openmsx::FileOperations::getCurrentWorkingDirectory ()
 Returns the current working directory.
 
string openmsx::FileOperations::getAbsolutePath (std::string_view path)
 Transform given path into an absolute path.
 
bool openmsx::FileOperations::isAbsolutePath (std::string_view path)
 Checks whether it's a absolute path or not.
 
string openmsx::FileOperations::getUserHomeDir (std::string_view username)
 Get user's home directory.
 
const string & openmsx::FileOperations::getUserOpenMSXDir ()
 Get the openMSX dir in the user's home directory.
 
const string & openmsx::FileOperations::getUserDataDir ()
 Get the openMSX data dir in the user's home directory.
 
const string & openmsx::FileOperations::getSystemDataDir ()
 Get system directory.
 
const string & openmsx::FileOperations::getSystemDocDir ()
 Get system doc directory.
 
std::optional< Statopenmsx::FileOperations::getStat (zstring_view filename)
 Call stat() and return the stat structure.
 
bool openmsx::FileOperations::isRegularFile (const Stat &st)
 
bool openmsx::FileOperations::isRegularFile (zstring_view filename)
 Is this a regular file (no directory, device, ..)?
 
bool openmsx::FileOperations::isDirectory (const Stat &st)
 
bool openmsx::FileOperations::isDirectory (zstring_view directory)
 Is this a directory?
 
bool openmsx::FileOperations::exists (zstring_view filename)
 Does this file (directory) exists?
 
string openmsx::FileOperations::getNextNumberedFileName (std::string_view directory, std::string_view prefix, std::string_view extension, bool addSeparator=false)
 Gets the next numbered file name with the specified prefix in the specified directory, with the specified extension.
 
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.
 
string openmsx::FileOperations::getTempDir ()
 Get the name of the temp directory on the system.
 
FILE_t 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

◆ MAXPATHLEN

#define MAXPATHLEN   4096

Definition at line 36 of file FileOperations.cc.