Skip to content

Commit fe29b35

Browse files
fredroybakpaul
andauthored
[Helper] FileSystem::createDirectory: fix missing return warning (#5929)
fix missing return warning Co-authored-by: Paul Baksic <30337881+bakpaul@users.noreply.github.com>
1 parent 6248867 commit fe29b35

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Sofa/framework/Helper/src/sofa/helper/system/FileSystem.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,21 +198,28 @@ bool FileSystem::createDirectory(const std::string& path)
198198
struct stat st_buf;
199199
if (stat(path.c_str(), &st_buf) == 0)
200200
{
201-
if ((st_buf.st_mode & S_IFMT) != S_IFDIR) {
202-
msg_error(error) << path << ": File exists and is not a directoy";
201+
if ((st_buf.st_mode & S_IFMT) != S_IFDIR)
202+
{
203+
msg_error(error) << path << ": File exists and is not a directory";
203204
return true;
204205
}
205206
else
206207
{
208+
// 'path' was already created and is a folder
207209
return false;
208210
}
209211
}
210-
212+
else
213+
{
214+
msg_error(error) << path << ": Unknown error while trying to create this directory.";
215+
return true;
216+
}
211217
}
212218
}
213219
#endif
214220
else
215221
{
222+
// 'path' has been created sucessfully
216223
return false;
217224
}
218225
}

0 commit comments

Comments
 (0)