Allow filesystem path directly in ar recorder

This commit is contained in:
Georg Hagen
2024-06-17 13:36:04 +02:00
parent c7a4b4a684
commit 29a5fd9ed7
2 changed files with 21 additions and 10 deletions

View File

@@ -26,7 +26,7 @@ namespace OpenVulkano::AR
namespace
{
constexpr std::string_view RECORDING_METADATA_FILENAME = "ArRecording.xml";
std::filesystem::path GeneratePath(const std::filesystem::path& baseDir, std::string_view name)
{
std::stringstream ss;
@@ -185,18 +185,17 @@ namespace OpenVulkano::AR
}
}
void ArRecorder::SetRecordingPath(const std::string& path)
void ArRecorder::SetRecordingPath(const std::filesystem::path& path)
{
if (!m_session) return;
if (!m_colorWriter)
{
std::filesystem::path p(path);
for (MultiPartArchiveWriter* writer: { m_colorWriter.get(), m_depthWriter.get(), m_confidenceWriter.get(), m_metadataWriter.get(), m_highResWriter.get() })
{
if (writer) writer->Move(p);
if (writer) writer->Move(path);
}
if (std::filesystem::exists(m_settings.path / RECORDING_METADATA_FILENAME))
std::filesystem::rename(m_settings.path / RECORDING_METADATA_FILENAME, p / RECORDING_METADATA_FILENAME);
std::filesystem::rename(m_settings.path / RECORDING_METADATA_FILENAME, path / RECORDING_METADATA_FILENAME);
}
m_persistent = true;