mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-05-11 15:05:04 +00:00
Create directories for templater output
This commit is contained in:
parent
03dd0f06b2
commit
a7ceaf03ee
@ -213,12 +213,8 @@ namespace templating
|
|||||||
|
|
||||||
if (!m_write_output_to_file)
|
if (!m_write_output_to_file)
|
||||||
{
|
{
|
||||||
m_output_stream = std::ofstream(m_output_file, std::ios::out | std::ios::binary);
|
if (!OpenOutputStream())
|
||||||
if (!m_output_stream.is_open())
|
|
||||||
{
|
|
||||||
std::cerr << "Failed to open output file \"" << m_output_file << "\"\n";
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
const auto cachedData = m_output_cache.str();
|
const auto cachedData = m_output_cache.str();
|
||||||
if (!cachedData.empty())
|
if (!cachedData.empty())
|
||||||
@ -296,12 +292,8 @@ namespace templating
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_output_file = (m_output_directory / fileName).string();
|
m_output_file = (m_output_directory / fileName).string();
|
||||||
m_output_stream = std::ofstream(m_output_file, std::ios::out | std::ios::binary);
|
if (!OpenOutputStream())
|
||||||
if (!m_output_stream.is_open())
|
|
||||||
{
|
|
||||||
std::cerr << "Failed to open output file \"" << m_output_file << "\"\n";
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
m_write_output_to_file = true;
|
m_write_output_to_file = true;
|
||||||
const auto cachedData = m_output_cache.str();
|
const auto cachedData = m_output_cache.str();
|
||||||
@ -314,6 +306,22 @@ namespace templating
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool OpenOutputStream()
|
||||||
|
{
|
||||||
|
const auto parentDir = fs::path(m_output_file).parent_path();
|
||||||
|
if (!parentDir.empty())
|
||||||
|
create_directories(parentDir);
|
||||||
|
|
||||||
|
m_output_stream = std::ofstream(m_output_file, std::ios::out | std::ios::binary);
|
||||||
|
if (!m_output_stream.is_open())
|
||||||
|
{
|
||||||
|
std::cerr << "Failed to open output file \"" << m_output_file << "\"\n";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::unique_ptr<ITemplatingVariation>> m_active_variations;
|
std::vector<std::unique_ptr<ITemplatingVariation>> m_active_variations;
|
||||||
std::unordered_map<std::string, ITemplatingVariation*> m_active_variations_by_name;
|
std::unordered_map<std::string, ITemplatingVariation*> m_active_variations_by_name;
|
||||||
TemplatingPass m_current_pass;
|
TemplatingPass m_current_pass;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user