Allow base folder to be overridden by reversing the mount paths lookup (#713)

* Allow base folder to be overridden by reversing the mount paths lookup

* Improve label communicating how assets work
This commit is contained in:
Crystalwarrior 2022-03-28 16:50:41 +03:00 committed by GitHub
parent 7e9ad9946b
commit 18412cc930
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -953,7 +953,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
ui_asset_lbl = new QLabel(ui_assets_tab);
ui_asset_lbl->setText(
tr("Add or remove base folders for use by assets. "
"Base folders will be searched in the order provided."));
"Base folders on the bottom are prioritized over those above them."));
ui_asset_lbl->setWordWrap(true);
ui_assets_tab_layout->addWidget(ui_asset_lbl);

View File

@ -267,8 +267,17 @@ QString AOApplication::get_real_path(const VPath &vpath) {
// Cache miss; try all known mount paths
QStringList bases = get_mount_paths();
bases.push_front(get_base_path());
bases.prepend(get_base_path());
// base
// content 1
// content 2
// We search last to first
std::reverse(bases.begin(), bases.end());
// content 2
// content 1
// base
for (const QString &base : bases) {
QDir baseDir(base);
QString path = baseDir.absoluteFilePath(vpath.toQString());