| 457 | class FileSystemStd : public IGFD::IFileSystem { |
| 458 | public: |
| 459 | bool IsDirectoryCanBeOpened(const std::string& vName) override { |
| 460 | bool bExists = false; |
| 461 | if (!vName.empty()) { |
| 462 | namespace fs = std::filesystem; |
| 463 | auto pathName = stringToPath(vName); |
| 464 | try { |
| 465 | // interesting, in the case of a protected dir or for any reason the dir cant be opened |
| 466 | // this func will work but will say nothing more . not like the dirent version |
| 467 | bExists = fs::is_directory(pathName); |
| 468 | // test if can be opened, this function can thrown an exception if there is an issue with this dir |
| 469 | // here, the dir_iter is need else not exception is thrown.. |
| 470 | const auto dir_iter = fs::directory_iterator(pathName); |
| 471 | (void)dir_iter; // for avoid unused warnings |
| 472 | } catch (const std::exception& /*ex*/) { |
| 473 | // fail so this dir cant be opened |
| 474 | bExists = false; |
| 475 | } |
| 476 | } |
| 477 | return bExists; // this is not a directory! |
| 478 | } |
| 479 | bool IsDirectoryExist(const std::string& vName) override { |
| 480 | if (!vName.empty()) { |
| 481 | namespace fs = std::filesystem; |
no test coverage detected