| 706 | } |
| 707 | |
| 708 | std::string FileUtils::fullPathForDirectory(std::string_view dir) const |
| 709 | { |
| 710 | auto result = std::string(); |
| 711 | |
| 712 | if (dir.empty()) |
| 713 | { |
| 714 | // result is "" |
| 715 | } |
| 716 | else if (isAbsolutePath(dir)) |
| 717 | { |
| 718 | result = dir; |
| 719 | } |
| 720 | else |
| 721 | { |
| 722 | // Already Cached ? |
| 723 | auto cacheIter = _fullPathCacheDir.find(dir); |
| 724 | if (cacheIter != _fullPathCacheDir.end()) |
| 725 | { |
| 726 | result = cacheIter->second; |
| 727 | } |
| 728 | else |
| 729 | { |
| 730 | std::string longdir{dir}; |
| 731 | |
| 732 | if (longdir[longdir.length() - 1] != '/') |
| 733 | { |
| 734 | longdir += "/"; |
| 735 | } |
| 736 | |
| 737 | for (const auto& searchIt : _searchPathArray) |
| 738 | { |
| 739 | auto fullpath = this->getPathForDirectory(longdir, searchIt); |
| 740 | if (!fullpath.empty() && isDirectoryExistInternal(fullpath)) |
| 741 | { |
| 742 | // Using the filename passed in as key. |
| 743 | _fullPathCacheDir.emplace(dir, fullpath); |
| 744 | result = fullpath; |
| 745 | break; |
| 746 | } |
| 747 | } |
| 748 | |
| 749 | if (result.empty() && isPopupNotify()) |
| 750 | { |
| 751 | AXLOGD("fullPathForDirectory: No directory found at {}. Possible missing directory.", dir); |
| 752 | } |
| 753 | } |
| 754 | } |
| 755 | |
| 756 | if (!result.empty() && result.back() != '/') |
| 757 | { |
| 758 | result += '/'; |
| 759 | } |
| 760 | |
| 761 | return result; |
| 762 | } |
| 763 | |
| 764 | std::string FileUtils::fullPathFromRelativeFile(std::string_view filename, std::string_view relativeFile) const |
| 765 | { |
no test coverage detected