Skip to content

Commit

Permalink
[Helper] Ensure exactly one directory separator
Browse files Browse the repository at this point in the history
  • Loading branch information
alxbilger committed Oct 21, 2024
1 parent fe3ddca commit 30d6dd1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Sofa/framework/Helper/src/sofa/helper/system/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,9 @@ int FileSystem::findFiles(const std::string& directoryPath,
return -1;

// Filter files
for (std::size_t i=0 ; i!=files.size() ; i++)
for (const auto& filename : files)
{
const std::string& filename = files[i];
const std::string& filepath = directoryPath + "/" + files[i];
const std::string& filepath = append(directoryPath, filename);

if ( isDirectory(filepath) && filename[0] != '.' && depth > 0 )
{
Expand Down Expand Up @@ -385,7 +384,7 @@ std::string FileSystem::findOrCreateAValidPath(const std::string path)

const std::string parentPath = FileSystem::getParentDirectory(path) ;
const std::string currentFile = FileSystem::stripDirectory(path) ;
FileSystem::createDirectory(findOrCreateAValidPath( parentPath )+"/"+currentFile) ;
FileSystem::createDirectory(append(findOrCreateAValidPath( parentPath ), currentFile)) ;
return path ;
}

Expand Down

0 comments on commit 30d6dd1

Please sign in to comment.