Fix evidence image lookup behaving weirdly if the mounted path from which it looks for evidence starts with "base" , so "base_Extra" will be ignored for example if it's next to the normal "base" folder (#825)

Start evidence image search in the base evidence folder rather than the topmost mounted path
This commit is contained in:
Crystalwarrior 2022-07-29 18:39:10 +03:00 committed by GitHub
parent 3c3002122e
commit da5437ab6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -398,7 +398,7 @@ void Courtroom::on_evidence_image_name_edited()
void Courtroom::on_evidence_image_button_clicked()
{
QDir dir(ao_app->get_real_path(ao_app->get_evidence_path("")));
QDir dir("base/evidence/");
QFileDialog dialog(this);
dialog.setFileMode(QFileDialog::ExistingFile);
dialog.setNameFilter(tr("Images (*.png)"));
@ -418,7 +418,7 @@ void Courtroom::on_evidence_image_button_clicked()
bases.prepend(ao_app->get_base_path());
for (const QString &base : bases) {
QDir baseDir(base);
if (filename.startsWith(baseDir.absolutePath())) {
if (filename.startsWith(baseDir.absolutePath() + "/")) {
dir.setPath(baseDir.absolutePath() + "/evidence");
break;
}