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__
if ( (length() > CYGDRIVE_PATH.length() + 1) && begins(CYGDRIVE_PATH) ) {
zap(0, CYGDRIVE_PATH.length() - 1); // whack the cygdrive portion plus two slashes.
insert(1, ":"); // add a colon after the imputed drive letter.
-LOG(astring("turned cygdrive string into: ") + *this);
+//LOG(astring("turned cygdrive string into: ") + *this);
}
// now we convert msys...
if ( (length() >= 2) && (get(0) == DEFAULT_SEPARATOR)
// then only on the near defunct windows platform.
zap(0, 0); // take off initial slash.
insert(1, ":"); // add the obligatory colon.
-LOG(astring("turned msys string into: ") + *this);
+//LOG(astring("turned msys string into: ") + *this);
}
}
#endif
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;
}
{
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)