25 lines
674 B
C++
25 lines
674 B
C++
#include <filesystem>
|
|
|
|
#include "src/Accelerators/PIM/Common/Support/FileSystemUtils.hpp"
|
|
#include "src/Compiler/CompilerOptions.hpp"
|
|
|
|
namespace onnx_mlir {
|
|
|
|
std::string getOutputDir() {
|
|
if (outputBaseName.empty() || outputBaseName == "-")
|
|
return {};
|
|
|
|
size_t lastSlash = outputBaseName.find_last_of('/');
|
|
if (lastSlash == std::string::npos)
|
|
return ".";
|
|
return outputBaseName.substr(0, lastSlash);
|
|
}
|
|
|
|
void createDirectory(const std::string& directory) {
|
|
std::error_code errorCode;
|
|
std::filesystem::create_directories(directory, errorCode);
|
|
assert(!errorCode && ("Failed to create directory: " + errorCode.message()).data());
|
|
}
|
|
|
|
} // namespace onnx_mlir
|