@@ -813,6 +813,11 @@ std::string FileUtils::getPathForFilename(const std::string& filename, const std
813
813
return path;
814
814
}
815
815
816
+ std::string FileUtils::getPathForDirectory (const std::string &dir, const std::string &resolutionDiretory, const std::string &searchPath) const
817
+ {
818
+ return searchPath + resolutionDiretory + dir;
819
+ }
820
+
816
821
std::string FileUtils::fullPathForFilename (const std::string &filename) const
817
822
{
818
823
@@ -893,14 +898,14 @@ std::string FileUtils::fullPathForDirectory(const std::string &dir) const
893
898
longdir +=" /" ;
894
899
}
895
900
901
+ const std::string newdirname ( getNewFilename (longdir) );
902
+
896
903
for (const auto & searchIt : _searchPathArray)
897
904
{
898
905
for (const auto & resolutionIt : _searchResolutionsOrderArray)
899
906
{
900
- fullpath.assign (searchIt).append (longdir).append (resolutionIt);
901
- auto exists = isDirectoryExistInternal (fullpath);
902
-
903
- if (exists && !fullpath.empty ())
907
+ fullpath = this ->getPathForDirectory (newdirname, resolutionIt, searchIt);
908
+ if (!fullpath.empty () && isDirectoryExistInternal (fullpath))
904
909
{
905
910
// Using the filename passed in as key.
906
911
_fullPathCacheDir.emplace (dir, fullpath);
@@ -1164,30 +1169,10 @@ bool FileUtils::isDirectoryExist(const std::string& dirPath) const
1164
1169
if (isAbsolutePath (dirPath))
1165
1170
{
1166
1171
return isDirectoryExistInternal (dirPath);
1172
+ } else {
1173
+ auto fullPath = fullPathForDirectory (dirPath);
1174
+ return !fullPath.empty ();
1167
1175
}
1168
-
1169
- // Already Cached ?
1170
- auto cacheIter = _fullPathCacheDir.find (dirPath);
1171
- if ( cacheIter != _fullPathCacheDir.end () )
1172
- {
1173
- return isDirectoryExistInternal (cacheIter->second );
1174
- }
1175
-
1176
- std::string fullpath;
1177
- for (const auto & searchIt : _searchPathArray)
1178
- {
1179
- for (const auto & resolutionIt : _searchResolutionsOrderArray)
1180
- {
1181
- // searchPath + file_path + resourceDirectory
1182
- fullpath = fullPathForDirectory (std::string (searchIt).append (dirPath).append (resolutionIt));
1183
- if (isDirectoryExistInternal (fullpath))
1184
- {
1185
- _fullPathCacheDir.emplace (dirPath, fullpath);
1186
- return true ;
1187
- }
1188
- }
1189
- }
1190
- return false ;
1191
1176
}
1192
1177
1193
1178
void FileUtils::isDirectoryExist (const std::string& fullPath, std::function<void (bool )> callback) const
0 commit comments