Fabrique

A build language for complex systems

 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
os.h File Reference

Declarations of OS-abstraction functions. More...

#include <functional>
#include <string>
#include <vector>

Go to the source code of this file.

Typedefs

typedef std::function
< std::string(std::string,
const std::vector< std::string > &)> 
fabrique::MissingFileReporter
 

Functions

bool fabrique::FileIsExecutable (std::string path)
 Check whether a file is executable on this platform.
 
bool fabrique::FileIsSharedLibrary (std::string path)
 Test whether this platform can load a file as a shared library.
 
bool fabrique::PathIsAbsolute (const std::string &)
 The named path is absolute, whether or not the file actually exists.
 
bool fabrique::PathIsDirectory (std::string)
 Does the named path exist, and is it a directory?
 
bool fabrique::PathIsFile (std::string)
 Does the named path exist, and is it a regular file?
 
MissingFileReporter fabrique::DefaultFilename (std::string name="")
 Create a std::function that returns a default filename.
 
std::string fabrique::FileNotFound (std::string name, const std::vector< std::string > &searchPaths)
 Throw a UserError to report a missing file.
 
std::string fabrique::AbsoluteDirectory (std::string name, bool createIfMissing=true)
 Find the absolute version of a directory, optionally creating it.
 
std::string fabrique::AbsolutePath (std::string path)
 Find the absolute version of a path (file or directory).
 
std::string fabrique::BaseName (std::string path)
 Get the basename of a path: 'foo/bar.c' -> 'bar'.
 
std::string fabrique::CreateDirCommand (std::string directory)
 The command required to create a directory (if it doesn't already exist).
 
std::string fabrique::DirectoryOf (std::string filename, bool absolute=false)
 Find the directory containing a file, optionally returning an absolute path.
 
std::string fabrique::FileExtension (std::string path)
 Get the extension of a path: 'foo/bar.c' -> 'c'.
 
std::string fabrique::FilenameComponent (std::string pathIncludingDirectory)
 Find the non-directory component of a path.
 
std::string fabrique::FindExecutable (std::string name, MissingFileReporter report=FileNotFound)
 Search the current PATH for an executable file.
 
std::string fabrique::FindFile (std::string filename, const std::vector< std::string > &directories, std::function< bool(const std::string &)> test=PathIsFile, MissingFileReporter report=FileNotFound)
 Find a file named filename within a set of directories. More...
 
std::string fabrique::JoinPath (const std::string &, const std::string &)
 Join two path components (a directory and a filename).
 
std::string fabrique::JoinPath (const std::vector< std::string > &)
 Join an arbitrary number of path components (directories and maybe a filename).
 
std::string fabrique::LibraryFilename (std::string name)
 Convert a library name (e.g., "foo") into a filename (e.g., "libfoo.so").
 
std::vector< std::string > fabrique::PluginSearchPaths (std::string executablePath)
 Where are plugins kept on this platform? More...
 
std::string fabrique::FindModule (std::string srcroot, std::string subdir, std::string filename)
 Find the name of a Fabrique module within the srcroot and platform search paths.
 

Detailed Description

Declarations of OS-abstraction functions.

Definition in file os.h.