Skip to content

Commit

Permalink
Allow base folder to be overridden by reversing the mount paths lookup (
Browse files Browse the repository at this point in the history
AttorneyOnline#713)

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

* Improve label communicating how assets work
  • Loading branch information
Crystalwarrior authored Mar 28, 2022
1 parent 7e9ad99 commit 18412cc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/aooptionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
11 changes: 10 additions & 1 deletion src/path_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 18412cc

Please sign in to comment.