Compare commits
7 Commits
2a8e3c2dc4
...
62d0579f40
Author | SHA1 | Date | |
---|---|---|---|
62d0579f40 | |||
202595b2a6 | |||
cb21ff3f04 | |||
8459d3baea | |||
8d04af691e | |||
6c34198f58 | |||
f63c58169f |
@ -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};
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user