mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -04:00
whee, new functionality
This commit is contained in:
parent
2bfcda82d4
commit
9a80bf5ea2
@ -711,6 +711,30 @@ is_directory() const {
|
|||||||
return isdir;
|
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
|
// Function: Filename::compare_timestamps
|
||||||
// Access: Public
|
// Access: Public
|
||||||
|
@ -129,6 +129,7 @@ PUBLISHED:
|
|||||||
bool exists() const;
|
bool exists() const;
|
||||||
bool is_regular_file() const;
|
bool is_regular_file() const;
|
||||||
bool is_directory() const;
|
bool is_directory() const;
|
||||||
|
bool is_executable() const;
|
||||||
int compare_timestamps(const Filename &other,
|
int compare_timestamps(const Filename &other,
|
||||||
bool this_missing_is_old = true,
|
bool this_missing_is_old = true,
|
||||||
bool other_missing_is_old = true) const;
|
bool other_missing_is_old = true) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user