Compare commits

...

7 Commits

3 changed files with 13 additions and 6 deletions

View File

@ -93,7 +93,9 @@ Result<FileStat> PassThroughFS::statPath(StringViewCR path) const noexcept {
oxTracef("ox.fs.PassThroughFS.statInode", "{} {}", ec.message(), path);
const uint64_t size = type == FileType::Directory ? 0 : std::filesystem::file_size(p, ec);
oxTracef("ox.fs.PassThroughFS.statInode.size", "{} {}", path, size);
OX_RETURN_ERROR(ox::Error(static_cast<ox::ErrorCode>(ec.value()), "PassThroughFS: stat failed"));
if (auto err = ec.value()) {
return ox::Error{static_cast<ox::ErrorCode>(err), "PassThroughFS: stat failed"};
}
return FileStat{0, 0, size, type};
}

View File

@ -64,12 +64,16 @@ ox::Result<ox::CStringView> uuidToPath(Context &ctx, ox::UUID const&uuid) noexce
namespace detail {
template<typename T>
constexpr auto makeLoader(Context &ctx) {
return [&ctx](ox::StringViewCR assetId) -> ox::Result<T> {
auto const p = ctx.uuidToPath.at(assetId);
if (p.error) {
return ox::Error{1, "Asset ID not found"};
return [&ctx](ox::StringView assetId) -> ox::Result<T> {
if (!beginsWith(assetId, "/")) {
auto const p = ctx.uuidToPath.at(assetId);
if (p.error) {
oxErrf("Could not find asset: {}", assetId);
return ox::Error{1, "Asset ID not found"};
}
assetId = *p.value;
}
OX_REQUIRE(buff, ctx.rom->read(*p.value));
OX_REQUIRE(buff, ctx.rom->read(assetId));
auto [obj, err] = readAsset<T>(buff);
if (err) {
if (err != ox::Error_ClawTypeVersionMismatch && err != ox::Error_ClawTypeMismatch) {

View File

@ -9,6 +9,7 @@
#include <studio/dragdrop.hpp>
#include <studio/editor.hpp>
#include <studio/filedialog.hpp>
#include <studio/filepickerpopup.hpp>
#include <studio/filetreemodel.hpp>
#include <studio/imguiutil.hpp>
#include <studio/module.hpp>