Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
Release 1.2.0

See merge request ii887522/nitro!56
  • Loading branch information
ii887522 committed May 19, 2021
2 parents 4439197 + f42ae04 commit 3607329
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 11 deletions.
1 change: 1 addition & 0 deletions nitro/nitro.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\main\Allocator\linear_allocator.h" />
<ClCompile Include="src\main\Functions\fs_ext.cpp" />
<ClCompile Include="src\main\Functions\math_ext.cpp" />
<ClCompile Include="src\main\Functions\string_ext.cpp" />
<ClCompile Include="src\test\Any\AnimatedAny.test.cpp" />
Expand Down
18 changes: 12 additions & 6 deletions nitro/nitro.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
<Filter Include="Header Files\Allocator">
<UniqueIdentifier>{32fab255-14c2-421b-b489-35537f8e9d5e}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Functions">
<UniqueIdentifier>{92726427-7da4-410e-aed0-fd3baf3e765e}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\main\Any\AnimatedAny.h">
Expand Down Expand Up @@ -151,12 +154,6 @@
<ClCompile Include="src\main\Allocator\linear_allocator.h">
<Filter>Header Files\Allocator</Filter>
</ClCompile>
<ClCompile Include="src\main\Functions\math_ext.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\main\Functions\string_ext.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\test\Functions\fs_ext.test.cpp">
<Filter>Test Source Files\Functions</Filter>
</ClCompile>
Expand All @@ -166,5 +163,14 @@
<ClCompile Include="src\test\Functions\util.test.cpp">
<Filter>Test Source Files\Functions</Filter>
</ClCompile>
<ClCompile Include="src\main\Functions\math_ext.cpp">
<Filter>Source Files\Functions</Filter>
</ClCompile>
<ClCompile Include="src\main\Functions\string_ext.cpp">
<Filter>Source Files\Functions</Filter>
</ClCompile>
<ClCompile Include="src\main\Functions\fs_ext.cpp">
<Filter>Source Files\Functions</Filter>
</ClCompile>
</ItemGroup>
</Project>
18 changes: 18 additions & 0 deletions nitro/src/main/Functions/fs_ext.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright ii887522

#include "fs_ext.h" // NOLINT(build/include_subdir)
#include <string>
#include <filesystem>

using std::string;
using std::filesystem::remove_all;
using std::filesystem::create_directory;

namespace ii887522::nitro {

void emptyDir(const string& path) {
remove_all(path);
create_directory(path);
}

} // namespace ii887522::nitro
3 changes: 3 additions & 0 deletions nitro/src/main/Functions/fs_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ template <typename T, template <typename> typename U> void write(const string& f
file.close();
}

// Param path: it must ends with either '/' or '\\'
void emptyDir(const string& path);

} // namespace ii887522::nitro

#endif // NITRO_SRC_MAIN_FUNCTIONS_FS_EXT_H_
10 changes: 6 additions & 4 deletions nitro/src/test/Functions/fs_ext.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,18 @@ static void testRead() {
assert((read<char, vector>("res/test/a.dat").size() == 0u));
{
const vector<char> str{ read<char, vector>("res/test/b.dat") };
assert(str.size() == 2u);
assert(str.size() == 3u);
assert(str[0u] == 'a');
assert(str[1u] == '\n');
assert(str[1u] == '\r');
assert(str[2u] == '\n');
}
{
const vector<char> str{ read<char, vector>("res/test/c.dat") };
assert(str.size() == 3u);
assert(str.size() == 4u);
assert(str[0u] == 'a');
assert(str[1u] == 'b');
assert(str[2u] == '\n');
assert(str[2u] == '\r');
assert(str[3u] == '\n');
}
{
const vector<unsigned int> ns{ read<unsigned int, vector>("res/test/d.dat") };
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nitro",
"version": "1.1.1",
"version": "1.2.0",
"description": "It is a general purpose C++ library that can help developers create various kinds of applications in no time.",
"scripts": {
"install": "node build.js"
Expand Down

0 comments on commit 3607329

Please sign in to comment.