// this doesn't work when a sequence changes something (like its
// name)
//else if (analysis->is_dirty())
- analysis->save();
+ try {
+ analysis->save();
+ } catch (std::exception e) {
+ QMessageBox::critical(this,
+ tr("Mussa Save Error"),
+ tr(e.what()),
+ QMessageBox::Ok, 0, 0);
+ }
+
}
}
}
if (fileNames.size() != 1) {
return;
}
- fs::path save_path(fileNames[0].toStdString(), fs::native);
- // do you want to overwrite?
- if (fs::exists(save_path) and
- QMessageBox::question(
- this,
- tr("Overwrite File? -- Mussa"),
- tr("A file called %1 already exists"
- "do you want to overwrite it?")
- .arg(fileNames[0]),
- tr("&Yes"), tr("&No"),
- QString(), 0, 1)
- ) {
- return;
+ try {
+ fs::path save_path(fileNames[0].toStdString(), fs::native);
+ // do you want to overwrite?
+ if (fs::exists(save_path) and
+ QMessageBox::question(
+ this,
+ tr("Overwrite File? -- Mussa"),
+ tr("A file called %1 already exists"
+ "do you want to overwrite it?")
+ .arg(fileNames[0]),
+ tr("&Yes"), tr("&No"),
+ QString(), 0, 1)
+ ) {
+ return;
+ }
+ analysis->save(save_path);
+ fs::path normalized_path = (save_path / "..").normalize();
+ default_dir->setPath(normalized_path.native_directory_string().c_str());
+ } catch (std::exception e) {
+ QMessageBox::critical(this,
+ tr("Mussa Save Error"),
+ tr(e.what()),
+ QMessageBox::Ok, 0, 0);
}
- analysis->save(save_path);
- fs::path normalized_path = (save_path / "..").normalize();
- default_dir->setPath(normalized_path.native_directory_string().c_str());
}
bool MussaWindow::isClearingAnalysisSafe()
analysis->load_motifs(converted_path);
default_dir->setPath(converted_path.branch_path().native_directory_string().c_str());
emit changedMotifs();
- } catch (runtime_error e) {
+ } catch (std::exception e) {
QString msg("Unable to load ");
msg += path;
msg += "\n";
fs::path converted_path(path.toStdString(), fs::native);
if (fs::extension(converted_path).size() == 0) {
// no extension, so add one
- converted_path = converted_path.string() + ".mtl";
+ fs::path base_path = converted_path.branch_path();
+ fs::path filename(converted_path.leaf() + ".mtl", fs::native);
+ converted_path = base_path / filename;
}
analysis->save_motifs(converted_path);
default_dir->setPath(converted_path.branch_path().native_directory_string().c_str());
- } catch (runtime_error e) {
+ } catch (std::exception e) {
QString msg("Unable to save ");
msg += path;
msg += "\n";