34 #ifndef CARTOBASE_STREAM_FILEUTIL_H 35 #define CARTOBASE_STREAM_FILEUTIL_H 43 #define CARTOBASE_STREAM_NULLDEVICE "nul" 45 #define CARTOBASE_STREAM_NULLDEVICE "/dev/null" 73 static std::string
basename(
const std::string & );
79 static std::string
dirname(
const std::string & );
84 static std::string
fileStat(
const std::string & );
86 static std::string
extension(
const std::string & );
90 static bool isAbsPath(
const std::string & path );
105 static std::string
temporaryFile(
const std::string & prefix,
int & fd );
110 static std::list<std::string>
112 const std::string & separator );
119 static std::string
linuxFilename(
const std::string & filename);
130 static std::string
uriFilename(
const std::string & filein );
static std::string linuxFilename(const std::string &filename)
Replaces backslashes with slashes characters on Windows OS on other OS, leaves filename unchanged...
static std::string extension(const std::string &)
returns the file extension (without the dot)
static std::string basename(const std::string &)
this is NOT conform to basename() from libgen: ::basename( "/" ) = "/", carto::FileUtil::basename( "/...
Files and filenames portable utilities.
static std::string fileStat(const std::string &)
Checks file existence, type and read/write permission.
static std::string removeExtension(const std::string &)
returns the filename without its extension
static std::string windowsFilename(const std::string &filename)
Replaces slashes with backslashes characters.
static char separator()
returns '/' on Unix systems and '\' on Windows systems
static std::string temporaryFile(const std::string &prefix, int &fd)
opens a temporary file.
static std::string uriCopyOptions(const std::string &filein)
Extracts the options from the URI and returns them as a string : "?options1=this&option2=that".
*static char pathSeparator()
character separating paths in a list (generally in an environment variable).
static std::string dirname(const std::string &)
this is NOT conform to dirname() from libgen: ::dirname( "/usr/" ) = "/", carto::FileUtil::dirname( "...
static bool isAbsPath(const std::string &path)
true if path is an absolute path, false if it is relative
static std::list< std::string > filenamesSplit(const std::string &filenames, const std::string &separator)
interpret the filenames string as a list of filenames and split it.
static std::string uriFilename(const std::string &filein)
It is possible to treat an URI (Uniform Resource Identifier) instead of a simple path.
static std::string temporaryDirectory(const std::string &prefix)
Creates a temporary directory.
static Object uriOptions(const std::string &filein)
Extracts the options from the URI and returns them as a dictionary of strings : ( "options1" => "this...