X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=nucleus%2Flibrary%2Ffilesystem%2Ffilename.h;h=06f7c2542970b6e57eb8e6ed505e1f125619b0a4;hb=ff8a9e8a414afa569a8e4c13bb59a40f01f4cbe8;hp=a6018ef53313ab4488e3449dcb9a491454db1d36;hpb=3ea085ec301ed1399dfa1e9f3a240312dc95410b;p=feisty_meow.git diff --git a/nucleus/library/filesystem/filename.h b/nucleus/library/filesystem/filename.h index a6018ef5..06f7c254 100644 --- a/nucleus/library/filesystem/filename.h +++ b/nucleus/library/filesystem/filename.h @@ -23,11 +23,15 @@ // forward declarations. class status_info; -//hmmm: this doesn't really belong here, does it. - +//hmmm: this doesn't really belong here, does it... // define useful constant for filesystem path length. #ifndef MAX_ABS_PATH #ifdef __WIN32__ + // winsock support... +// #undef FD_SETSIZE +// #define FD_SETSIZE 1000 + // if you don't set this, you can only select on a default of 64 sockets. + #include #include #define MAX_ABS_PATH MAX_PATH #else @@ -57,6 +61,8 @@ public: /*!< the "name_of_file" can itself be a directory. */ filename(const filename &to_copy); //!< copy constructor. + DEFINE_CLASS_NAME("filename"); + virtual ~filename(); bool good() const; @@ -64,6 +70,9 @@ public: /*!< this means that not only was the pathname parsed and found valid, but the file actually exists. */ + void reset(const basis::astring &name); + //!< changes the file name held by the object. + const basis::astring &raw() const; //!< returns the astring that we're holding onto for the path. basis::astring &raw(); @@ -142,6 +151,10 @@ public: bool is_readable() const; bool is_executable() const; + // is_normal makes sure that the file or directory is not a named pipe or other + // special type of file. symbolic links are considered normal. + bool is_normal() const; + enum write_modes { ALLOW_NEITHER = 0x0, ALLOW_READ = 0x1, ALLOW_WRITE = 0x2, @@ -182,18 +195,19 @@ public: the file to be created or accessed). the "replacement" is used as the character that is substituted instead of illegal characters. */ - void separate(structures::string_array &pieces) const; - //!< breaks the filename into its component directories. - /*!< this returns an array containing the component names. the last - component, unless the filename held is actually a directory, should be the - name of the file. if the first character is a directory, then the first - component will be empty. */ + void separate(bool &rooted, structures::string_array &pieces) const; + //!< breaks the filename into its component parts. + /*!< this returns an array containing the component names for the path in + this filename object. if the "rooted" flag is set to true, then the path + was absolute (i.e. started at '/' in unix. this notion is not needed for + dos/windoze, as the first component will be something like 'a:'). */ - void join(const structures::string_array &pieces); + void join(bool rooted, const structures::string_array &pieces); //!< undoes a separate() operation to get the filename back. /*!< "this" is set to a filename made from each of the "pieces". if there - are any directory separators inside the pieces, then they will be removed - by canonicalize(). */ + are any directory separators inside the pieces themselves, then they will + be removed by canonicalize(). if separate() said the path was rooted, + then join needs to be told that. */ // these implement the packing functionality. virtual void pack(basis::byte_array &packed_form) const;