From b576ff57476157431a75bd314403403045e80915 Mon Sep 17 00:00:00 2001 From: Mathieu Moran Date: Sun, 13 Sep 2026 21:07:23 -0400 Subject: [PATCH] Settings: add Storage section showing state dir, DB, cover cache, and user data paths --- app/gui.py | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/app/gui.py b/app/gui.py index cedf434..5ea3bff 100644 --- a/app/gui.py +++ b/app/gui.py @@ -1280,6 +1280,22 @@ class SettingsPage(QWidget): form.addRow(self.clear_covers_btn) col.addWidget(box) + # -- Storage ---------------------------------------------------------- # + box, form = self._group("Storage") + self._path_row(form, "State directory", str(config.STATE_DIR)) + self._path_row(form, "Library database", str(config.DB_PATH)) + self._path_row(form, "Cover cache", str(config.COVERS_DIR)) + self._path_row(form, "User data (credentials, NPS cache…)", str(config.USER_DATA_DIR)) + note = QLabel( + "Your library, covers, and credentials live here — outside the app " + "bundle, so they survive upgrades. On Linux this is the " + "~/.local/state/psp-preserve folder." + ) + note.setWordWrap(True) + note.setStyleSheet("color: #9a9ba5;") + form.addRow(note) + col.addWidget(box) + col.addStretch(1) def _group(self, title): @@ -1342,6 +1358,29 @@ class SettingsPage(QWidget): form.addRow(label, edit) return edit + def _path_row(self, form, label, path): + edit = QLineEdit(path) + edit.setReadOnly(True) + open_btn = QPushButton("Open") + open_btn.clicked.connect(lambda _=False, p=Path(path): self._open_path(p)) + row = QWidget() + h = QHBoxLayout(row) + h.setContentsMargins(0, 0, 0, 0) + h.addWidget(edit, 1) + h.addWidget(open_btn) + form.addRow(label, row) + return edit + + @staticmethod + def _open_path(path): + path = Path(path) + target = path if path.is_dir() else path.parent + if target.is_dir(): + QDesktopServices.openUrl(QUrl.fromLocalFile(str(target))) + else: + QMessageBox.information(None, "Not found", + f"Folder not created yet:\n{target}\n\nIt is created on first use.") + def games_dir(self): return self.games_edit.text().strip()