Skip to content

Commit 0fc11df

Browse files
nyoungbqimikejackson
authored andcommitted
bug fix 2
1 parent 229a53e commit 0fc11df

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#include "FilterUtilities.hpp"
2+
3+
#include <fmt/core.h>
4+
5+
#include <string>
6+
7+
namespace nx::core
8+
{
9+
10+
// -----------------------------------------------------------------------------
11+
Result<> CreateOutputDirectories(const fs::path& outputPath)
12+
{
13+
if(!fs::exists(outputPath))
14+
{
15+
std::error_code errorCode;
16+
// So this looks weird but this can happen on
17+
// platforms where /tmp is a symlink to /private/tmp. So the original path is
18+
// /tmp/foo but what was created was /private/tmp/foo. This logic should fix that issue.
19+
if(!fs::create_directories(outputPath, errorCode) && !fs::exists(outputPath))
20+
{
21+
return MakeErrorResult(-4010, fmt::format("Unable to create output directory {}. Error code from operating system is {}", outputPath.string(), errorCode.value()));
22+
}
23+
}
24+
return {};
25+
}
26+
27+
// -----------------------------------------------------------------------------
28+
void AppendDataObjectModifications(const DataStructure& dataStructure, std::vector<DataObjectModification>& modifiedActions, const DataPath& parentPath, const std::vector<DataPath>& ignoredDataPaths)
29+
{
30+
std::optional<std::vector<DataPath>> result = nx::core::GetAllChildArrayDataPaths(dataStructure, parentPath, ignoredDataPaths);
31+
if(!result)
32+
{
33+
return;
34+
}
35+
36+
for(const auto& child : result.value())
37+
{
38+
modifiedActions.push_back(DataObjectModification{child, DataObjectModification::ModifiedType::Modified, dataStructure.getDataRef(child).getDataObjectType()});
39+
}
40+
}
41+
42+
} // namespace nx::core

0 commit comments

Comments
 (0)