X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=nucleus%2Flibrary%2Ffilesystem%2Ffilename.cpp;h=81ca6f02f69d7abd04724e4877110f3e05ad4bdd;hb=46db3e069f6346301f8d55a1d155a4904f18ec1e;hp=a77035baeabb3f795ad586b79ba471da3c62e0f9;hpb=1d0e3f784ca8c86185013026e8500f8460aefe8e;p=feisty_meow.git diff --git a/nucleus/library/filesystem/filename.cpp b/nucleus/library/filesystem/filename.cpp index a77035ba..81ca6f02 100644 --- a/nucleus/library/filesystem/filename.cpp +++ b/nucleus/library/filesystem/filename.cpp @@ -100,6 +100,12 @@ bool filename::good() const { return exists(); } bool filename::unlink() const { return ::unlink(observe()) == 0; } +void filename::reset(const astring &name) { + *this = name; + _had_directory = true; // until we know better. + canonicalize(); +} + astring filename::null_device() { #ifdef __WIN32__ @@ -309,10 +315,15 @@ bool filename::is_normal() const status_info fill; if (!get_info(&fill)) return false; +#if defined(__WIN32__) || defined(__VMS__) +//hmmm: is there a corresponding set of functions for windows, where applicable? + bool weird = false; +#else bool weird = S_ISCHR(fill.st_mode) || S_ISBLK(fill.st_mode) || S_ISFIFO(fill.st_mode) || S_ISSOCK(fill.st_mode); +#endif return !weird; } @@ -372,11 +383,10 @@ bool filename::exists() const { if (is_directory()) return true; + // if the file name is empty, that cannot exist. if (!length()) return false; return is_readable(); -/// byte_filer opened(observe(), "rb"); -/// return opened.good(); } bool filename::legal_character(char to_check)