* Checks if a certain path exists and is a folder. * @param path Full path to folder. * @return Does it exist? */
| 596 | * @return Does it exist? |
| 597 | */ |
| 598 | bool folderExists(const std::string &path) |
| 599 | { |
| 600 | #ifdef _WIN32 |
| 601 | return (PathIsDirectoryA(path.c_str()) != FALSE); |
| 602 | #elif __MORPHOS__ |
| 603 | BPTR l = Lock( path.c_str(), SHARED_LOCK ); |
| 604 | if( l != NULL ) |
| 605 | { |
| 606 | UnLock( l ); |
| 607 | return 1; |
| 608 | } |
| 609 | return 0; |
| 610 | #else |
| 611 | struct stat info; |
| 612 | return (stat(path.c_str(), &info) == 0 && S_ISDIR(info.st_mode)); |
| 613 | #endif |
| 614 | } |
| 615 | |
| 616 | /** |
| 617 | * Checks if a certain path exists and is a file. |
no test coverage detected