-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
229a53e
commit 0fc11df
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include "FilterUtilities.hpp" | ||
|
||
#include <fmt/core.h> | ||
|
||
#include <string> | ||
|
||
namespace nx::core | ||
{ | ||
|
||
// ----------------------------------------------------------------------------- | ||
Result<> CreateOutputDirectories(const fs::path& outputPath) | ||
{ | ||
if(!fs::exists(outputPath)) | ||
{ | ||
std::error_code errorCode; | ||
// So this looks weird but this can happen on | ||
// platforms where /tmp is a symlink to /private/tmp. So the original path is | ||
// /tmp/foo but what was created was /private/tmp/foo. This logic should fix that issue. | ||
if(!fs::create_directories(outputPath, errorCode) && !fs::exists(outputPath)) | ||
{ | ||
return MakeErrorResult(-4010, fmt::format("Unable to create output directory {}. Error code from operating system is {}", outputPath.string(), errorCode.value())); | ||
} | ||
} | ||
return {}; | ||
} | ||
|
||
// ----------------------------------------------------------------------------- | ||
void AppendDataObjectModifications(const DataStructure& dataStructure, std::vector<DataObjectModification>& modifiedActions, const DataPath& parentPath, const std::vector<DataPath>& ignoredDataPaths) | ||
{ | ||
std::optional<std::vector<DataPath>> result = nx::core::GetAllChildArrayDataPaths(dataStructure, parentPath, ignoredDataPaths); | ||
if(!result) | ||
{ | ||
return; | ||
} | ||
|
||
for(const auto& child : result.value()) | ||
{ | ||
modifiedActions.push_back(DataObjectModification{child, DataObjectModification::ModifiedType::Modified, dataStructure.getDataRef(child).getDataObjectType()}); | ||
} | ||
} | ||
|
||
} // namespace nx::core |