30 #define MAX_ABS_PATH MAX_PATH
33 #include <sys/syslimits.h>
37 #define MAX_ABS_PATH PATH_MAX
144 char drive(
bool interact_with_fs =
false)
const;
181 bool chmod(
int write_mode,
int owner_mode)
const;
259 bool get_info(status_info *to_fill)
const;
Provides a dynamically resizable ASCII character string.
void reset()
clears out the contents string.
A very common template for a dynamic array of bytes.
A base class for objects that can pack into an array of bytes.
Implements a scanner that finds all filenames in the directory specified.
Provides operations commonly needed on file names.
bool exists() const
returns true if the file exists.
static bool separator(char is_it)
returns true if the character "is_it" in question is a separator.
void canonicalize()
cleans up the filename as needed for the current operating system.
void join(bool rooted, const structures::string_array &pieces)
undoes a separate() operation to get the filename back.
bool good() const
returns true if the filename seems to be valid.
virtual bool unpack(basis::byte_array &packed_form)
Restores the packable from the "packed_form".
void separate(bool &rooted, structures::string_array &pieces) const
breaks the filename into its component parts.
bool compare_prefix(const filename &to_compare, basis::astring &sequel)
examines "this" filename to see if it's a prefix of "to_compare".
static basis::astring default_separator()
returns the default separator character for this OS.
basis::astring extension() const
returns the extension for the file, if one is present.
filename parent() const
returns the parent filename for this one.
directory_separator
the default separator for directories per operating system.
virtual void pack(basis::byte_array &packed_form) const
Creates a packed form of the packable object in "packed_form".
char drive(bool interact_with_fs=false) const
returns the drive letter for the file, without the colon.
basis::astring rootname() const
returns the root part of the basename without an extension.
bool compare_suffix(const filename &to_compare, basis::astring &prequel)
compares the back end of a filename to this.
bool had_directory() const
returns true if the name that we were given had a non-empty directory.
static basis::astring null_device()
returns the name for the black hole device that consumes all input, i.e. /dev/null.
bool chmod(int write_mode, int owner_mode) const
changes the access rights on the file.
bool is_directory() const
void push(const basis::astring &to_push)
pushes a new filename onto the current pathname.
const basis::astring & raw() const
returns the astring that we're holding onto for the path.
filename dirname() const
returns the directory for the filename.
bool is_executable() const
bool unlink() const
actually removes the file, if possible.
static void detooth_filename(basis::astring &to_clean, char replacement='_')
takes any known illegal file system characters out of "to_clean".
DEFINE_CLASS_NAME("filename")
filename basename() const
returns the base of the filename; no directory.
basis::astring pop()
removes the deepest component of the pathname.
filename & operator=(const filename &to_copy)
provides assignment for this object, plus a simple string.
static bool legal_character(char to_check)
returns true if "to_check" is a valid character in a filename.
virtual int packed_size() const
Estimates the space needed for the packed structure.
filename()
blank constructor.
An array of strings with some additional helpful methods.
A platform independent way to obtain the timestamp of a file.