* Checks if a certain path exists and is a file. * @param path Full path to file. * @return Does it exist? */
| 619 | * @return Does it exist? |
| 620 | */ |
| 621 | bool fileExists(const std::string &path) |
| 622 | { |
| 623 | #ifdef _WIN32 |
| 624 | return (PathFileExistsA(path.c_str()) != FALSE); |
| 625 | #elif __MORPHOS__ |
| 626 | BPTR l = Lock( path.c_str(), SHARED_LOCK ); |
| 627 | if( l != NULL ) |
| 628 | { |
| 629 | UnLock( l ); |
| 630 | return 1; |
| 631 | } |
| 632 | return 0; |
| 633 | #else |
| 634 | struct stat info; |
| 635 | return (stat(path.c_str(), &info) == 0 && S_ISREG(info.st_mode)); |
| 636 | #endif |
| 637 | } |
| 638 | |
| 639 | /** |
| 640 | * Removes a file from the specified path. |
no test coverage detected