Skip to content

Commit

Permalink
⚡ (filemanager): Allow creation of subdirectory if directory does not…
Browse files Browse the repository at this point in the history
… exist
  • Loading branch information
YannLocatelli committed Feb 1, 2023
1 parent c020b73 commit 638d96d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libs/FileManagerKit/source/FileManagerKit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ using namespace leka;

auto FileManagerKit::create_directory(const std::filesystem::path &path) -> bool
{
return std::filesystem::create_directory(path);
return std::filesystem::create_directories(path);
}

auto FileManagerKit::remove(const std::filesystem::path &path) -> bool
Expand Down
9 changes: 9 additions & 0 deletions libs/FileManagerKit/tests/FileManagerKit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ TEST_F(FileSystemTest, createSubDirectoryInExistingDirectory)
EXPECT_TRUE(is_created);
}

TEST_F(FileSystemTest, createSubDirectoryInNotExistingDirectory)
{
spy_remove_directory(path_directory);

auto is_created = FileManagerKit::create_directory(path_sub_directory);

EXPECT_TRUE(is_created);
}

TEST_F(FileSystemTest, removeExistingDirectory)
{
spy_create_directory(path_directory);
Expand Down

0 comments on commit 638d96d

Please sign in to comment.