whee, new functionality

This commit is contained in:
Cary Sandvig 2000-12-13 23:31:17 +00:00
parent 2bfcda82d4
commit 9a80bf5ea2
2 changed files with 25 additions and 0 deletions

View File

@ -711,6 +711,30 @@ is_directory() const {
return isdir;
}
////////////////////////////////////////////////////////////////////
// Function: Filename::is_executable
// Access: Public
// Description: Returns true if the filename exists and is
// executable
////////////////////////////////////////////////////////////////////
bool Filename::
is_executable() const {
if (!exists()) {
#ifdef WIN32_VC
// no access() in windows, but to our advantage executables can only
// end in .exe or .com
string stmp = to_os_specific();
stmp = stmp.substr(stmp.rfind(".") + 1);
if ((stmp == "exe") || (stmp == "com"))
return true;
#else /* WIN32_VC */
if (access(to_os_specific().c_str(), X_OK) == 0)
return true;
#endif /* WIN32_VC */
}
return false;
}
////////////////////////////////////////////////////////////////////
// Function: Filename::compare_timestamps
// Access: Public

View File

@ -129,6 +129,7 @@ PUBLISHED:
bool exists() const;
bool is_regular_file() const;
bool is_directory() const;
bool is_executable() const;
int compare_timestamps(const Filename &other,
bool this_missing_is_old = true,
bool other_missing_is_old = true) const;