Compare commits
2 Commits
3824788a1a
...
e34df255e0
Author | SHA1 | Date | |
---|---|---|---|
e34df255e0 | |||
7eab2f9278 |
@ -265,7 +265,7 @@ ox::Error engineCode() noexcept {
|
|||||||
auto [val, err] = foo(1);
|
auto [val, err] = foo(1);
|
||||||
oxReturnError(err);
|
oxReturnError(err);
|
||||||
doStuff(val);
|
doStuff(val);
|
||||||
return OxError(0);
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void anyCode() {
|
void anyCode() {
|
||||||
@ -288,7 +288,7 @@ ox::Error engineCode() noexcept {
|
|||||||
auto valerr = foo(1);
|
auto valerr = foo(1);
|
||||||
oxReturnError(valerr);
|
oxReturnError(valerr);
|
||||||
doStuff(valerr.value);
|
doStuff(valerr.value);
|
||||||
return OxError(0);
|
return {};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -426,7 +426,7 @@ constexpr ox::Error model(T *h, ox::CommonPtrWith<NostalgiaPalette> auto *pal) n
|
|||||||
// it is also possible to provide the type name and type version as function arguments
|
// it is also possible to provide the type name and type version as function arguments
|
||||||
//h->setTypeInfo("net.drinkingtea.nostalgia.core.NostalgiaPalette", 1);
|
//h->setTypeInfo("net.drinkingtea.nostalgia.core.NostalgiaPalette", 1);
|
||||||
oxReturnError(h->field("colors", &pal->colors));
|
oxReturnError(h->field("colors", &pal->colors));
|
||||||
return OxError(0);
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@ -438,7 +438,7 @@ constexpr ox::Error model(T *h, ox::CommonPtrWith<NostalgiaGraphic> auto *ng) no
|
|||||||
oxReturnError(h->field("defaultPalette", &ng->defaultPalette));
|
oxReturnError(h->field("defaultPalette", &ng->defaultPalette));
|
||||||
oxReturnError(h->field("pal", &ng->pal));
|
oxReturnError(h->field("pal", &ng->pal));
|
||||||
oxReturnError(h->field("pixels", &ng->pixels));
|
oxReturnError(h->field("pixels", &ng->pixels));
|
||||||
return OxError(0);
|
return {};
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -475,7 +475,7 @@ constexpr Error model(T *h, ox::CommonPtrWith<FileAddress::Data> auto *obj) noex
|
|||||||
oxReturnError(h->fieldCString("path", &obj->path));
|
oxReturnError(h->fieldCString("path", &obj->path));
|
||||||
oxReturnError(h->fieldCString("constPath", &obj->path));
|
oxReturnError(h->fieldCString("constPath", &obj->path));
|
||||||
oxReturnError(h->field("inode", &obj->inode));
|
oxReturnError(h->field("inode", &obj->inode));
|
||||||
return OxError(0);
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@ -492,7 +492,7 @@ constexpr Error model(T *io, ox::CommonPtrWith<FileAddress> auto *fa) noexcept {
|
|||||||
fa->m_type = static_cast<FileAddressType>(type);
|
fa->m_type = static_cast<FileAddressType>(type);
|
||||||
oxReturnError(io->field("data", UnionView(&fa->m_data, static_cast<int>(fa->m_type))));
|
oxReturnError(io->field("data", UnionView(&fa->m_data, static_cast<int>(fa->m_type))));
|
||||||
}
|
}
|
||||||
return OxError(0);
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -39,7 +39,7 @@ ox::Result<T> readConfig(keel::Context &ctx, ox::CRStringView name) noexcept {
|
|||||||
ox::PassThroughFS fs(configPath(ctx));
|
ox::PassThroughFS fs(configPath(ctx));
|
||||||
auto const [buff, err] = fs.read(path);
|
auto const [buff, err] = fs.read(path);
|
||||||
if (err) {
|
if (err) {
|
||||||
oxErrf("Could not read config file: {}\n", toStr(err));
|
//oxErrf("Could not read config file: {} - {}\n", path, toStr(err));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
return ox::readOC<T>(buff);
|
return ox::readOC<T>(buff);
|
||||||
@ -57,13 +57,13 @@ ox::Error writeConfig(keel::Context &ctx, ox::CRStringView name, T const&data) n
|
|||||||
auto const path = ox::sfmt("/{}.json", detail::slashesToPct(name));
|
auto const path = ox::sfmt("/{}.json", detail::slashesToPct(name));
|
||||||
ox::PassThroughFS fs(configPath(ctx));
|
ox::PassThroughFS fs(configPath(ctx));
|
||||||
if (auto const err = fs.mkdir("/", true)) {
|
if (auto const err = fs.mkdir("/", true)) {
|
||||||
oxErrf("Could not create config directory: {}\n", toStr(err));
|
//oxErrf("Could not create config directory: {} - {}\n", path, toStr(err));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
oxRequireM(buff, ox::writeOC(data));
|
oxRequireM(buff, ox::writeOC(data));
|
||||||
*buff.back().value = '\n';
|
*buff.back().value = '\n';
|
||||||
if (auto const err = fs.write(path, buff.data(), buff.size())) {
|
if (auto const err = fs.write(path, buff.data(), buff.size())) {
|
||||||
oxErrf("Could not read config file: {}\n", toStr(err));
|
//oxErrf("Could not read config file: {} - {}\n", path, toStr(err));
|
||||||
return OxError(2, "Could not read config file");
|
return OxError(2, "Could not read config file");
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user