[nostalgia,olympic] Cleanup
This commit is contained in:
@ -118,12 +118,12 @@ void NewMenu::drawLastPageButtons(studio::StudioContext &sctx) noexcept {
|
||||
|
||||
void NewMenu::finish(studio::StudioContext &sctx) noexcept {
|
||||
if (m_itemName.len() == 0) {
|
||||
oxLogError(OxError(1, "New file error: no file name"));
|
||||
oxLogError(ox::Error(1, "New file error: no file name"));
|
||||
return;
|
||||
}
|
||||
auto const&typeMaker = *m_types[static_cast<std::size_t>(m_selectedType)];
|
||||
if (sctx.project->exists(typeMaker.itemPath(m_itemName))) {
|
||||
oxLogError(OxError(1, "New file error: file already exists"));
|
||||
oxLogError(ox::Error(1, "New file error: file already exists"));
|
||||
return;
|
||||
}
|
||||
auto const [path, err] = typeMaker.write(sctx, m_itemName);
|
||||
|
@ -54,7 +54,7 @@ void ProjectExplorer::setModel(ox::UPtr<ProjectTreeModel> &&model) noexcept {
|
||||
ox::Error ProjectExplorer::refreshProjectTreeModel(ox::StringViewCR) noexcept {
|
||||
oxRequireM(model, buildProjectTreeModel(*this, "Project", "/", nullptr));
|
||||
setModel(std::move(model));
|
||||
return OxError(0);
|
||||
return ox::Error(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ void StudioUI::handleKeyInput() noexcept {
|
||||
ox::Error StudioUI::createOpenProject(ox::StringViewCR path) noexcept {
|
||||
std::error_code ec;
|
||||
std::filesystem::create_directories(toStdStringView(path), ec);
|
||||
oxReturnError(OxError(ec.value() != 0, "Could not create project directory"));
|
||||
oxReturnError(ox::Error(ec.value() != 0, "Could not create project directory"));
|
||||
oxReturnError(openProjectPath(path));
|
||||
return m_project->writeTypeStore();
|
||||
}
|
||||
@ -354,7 +354,7 @@ ox::Error StudioUI::openFile(ox::StringViewCR path) noexcept {
|
||||
|
||||
ox::Error StudioUI::openFileActiveTab(ox::StringViewCR path, bool makeActiveTab) noexcept {
|
||||
if (!m_project) {
|
||||
return OxError(1, "No project open to open a file from");
|
||||
return ox::Error(1, "No project open to open a file from");
|
||||
}
|
||||
if (m_openFiles.contains(path)) {
|
||||
for (auto &e : m_editors) {
|
||||
|
@ -64,7 +64,7 @@ ox::Error writeConfig(keel::Context &ctx, ox::StringViewCR name, T const&data) n
|
||||
*buff.back().value = '\n';
|
||||
if (auto const err = fs.write(path, buff.data(), buff.size())) {
|
||||
//oxErrf("Could not read config file: {} - {}\n", path, toStr(err));
|
||||
return OxError(2, "Could not read config file");
|
||||
return ox::Error(2, "Could not read config file");
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ template<typename T>
|
||||
ox::Result<T> getDragDropPayload(ox::CStringView name) noexcept {
|
||||
auto const payload = ImGui::AcceptDragDropPayload(name.c_str());
|
||||
if (!payload) {
|
||||
return OxError(1, "No drag/drop payload");
|
||||
return ox::Error(1, "No drag/drop payload");
|
||||
}
|
||||
return ox::readClaw<T>({
|
||||
reinterpret_cast<char const*>(payload->Data),
|
||||
|
@ -31,7 +31,7 @@ enum class ProjectEvent {
|
||||
constexpr ox::Result<ox::StringView> fileExt(ox::StringViewCR path) noexcept {
|
||||
auto const extStart = ox::find(path.crbegin(), path.crend(), '.').offset();
|
||||
if (!extStart) {
|
||||
return OxError(1, "file path does not have valid extension");
|
||||
return ox::Error(1, "file path does not have valid extension");
|
||||
}
|
||||
return substr(path, extStart + 1);
|
||||
}
|
||||
|
@ -31,9 +31,9 @@ OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
return out;
|
||||
}
|
||||
case NFD_CANCEL:
|
||||
return OxError(1, "Operation cancelled");
|
||||
return ox::Error(1, "Operation cancelled");
|
||||
default:
|
||||
return OxError(2, NFD::GetError());
|
||||
return ox::Error(2, NFD::GetError());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ Project::Project(keel::Context &ctx, ox::String path, ox::StringViewCR projectDa
|
||||
ox::Error Project::create() noexcept {
|
||||
std::error_code ec;
|
||||
std::filesystem::create_directory(m_path.toStdString(), ec);
|
||||
return OxError(static_cast<ox::ErrorCode>(ec.value()), "PassThroughFS: mkdir failed");
|
||||
return ox::Error(static_cast<ox::ErrorCode>(ec.value()), "PassThroughFS: mkdir failed");
|
||||
}
|
||||
|
||||
ox::String const&Project::projectPath() const noexcept {
|
||||
@ -62,7 +62,7 @@ ox::Error Project::mkdir(ox::StringViewCR path) const noexcept {
|
||||
fileUpdated.emit(path, {});
|
||||
}
|
||||
return stat.fileType == ox::FileType::Directory ?
|
||||
ox::Error{} : OxError(1, "path exists as normal file");
|
||||
ox::Error{} : ox::Error(1, "path exists as normal file");
|
||||
}
|
||||
|
||||
ox::Result<ox::FileStat> Project::stat(ox::StringViewCR path) const noexcept {
|
||||
|
Reference in New Issue
Block a user