Flatten src into model, edit and ui, with .h headers

Resources and utilities sit directly in src. The ImGui windows, wizards, popups and helpers are in ui.
Headers that would shadow system ones are renamed: math_util, timestamp, subprocess, localization.
Includes are written from src.
This commit is contained in:
shweet committed 2026-11-22 17:12:05 -05:00
1 parent a515267e26
commit 7fb2c607c2
175 files changed
+537 -537

No files matched your search

+48
View File
@@ -0,0 +1,48 @@
#include "working_directory.h"
#include <format>
#include "log.h"
#include "path.h"
namespace anm2ed::util
{
WorkingDirectory::WorkingDirectory(const std::filesystem::path& path, Type type)
{
std::error_code ec{};
previous = std::filesystem::current_path(ec);
if (ec)
{
logger.warning(std::format("Could not query current directory: {}", ec.message()));
previous.clear();
ec.clear();
}
if (type == FILE)
{
std::filesystem::path filePath = path;
std::filesystem::path parentPath = filePath.parent_path();
std::filesystem::current_path(parentPath, ec);
if (ec)
logger.warning(
std::format("Could not set current directory to {}: {}", path::to_utf8(parentPath), ec.message()));
}
else
{
std::filesystem::current_path(path, ec);
if (ec)
logger.warning(std::format("Could not set current directory to {}: {}", path::to_utf8(path), ec.message()));
}
}
WorkingDirectory::~WorkingDirectory()
{
if (previous.empty()) return;
std::error_code ec{};
std::filesystem::current_path(previous, ec);
if (ec)
logger.warning(
std::format("Could not restore current directory to {}: {}", path::to_utf8(previous), ec.message()));
}
}