feat: open the logs folder from the Settings tab
Reading a log file meant copying the configured path out of Settings and pasting it into a file manager. The Logs directory row now carries an Open button beside Browse that reveals the folder directly. The new src/platform/filemanager package holds the platform split — explorer on Windows, xdg-open on Linux, an "unsupported" error elsewhere — and starts the handler without waiting on it, since Explorer exits non-zero even after it opens the window and blocking would stall the UI thread. A missing path, a path that is a file, and a handler that will not start are all reported to the user; the logs directory does not exist until the first run, so that case is reachable. The button opens whatever the field currently holds rather than the saved config, so an edit can be checked before Save. Resolving a relative directory against the application folder is the store's rule, so resolveConfiguredDir is now exported as storage.ResolveConfiguredDir instead of being duplicated in the UI. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,7 @@ src/
|
||||
platform/
|
||||
autostart/ Manager interface + Windows (shortcut) and Linux (XDG) impls
|
||||
desktop/ display-scale helper (Linux only)
|
||||
filemanager/ open a folder in the desktop file manager
|
||||
winproc/ hidden-window startup flags (Windows only)
|
||||
ui/ Fyne windows, tabs, and dialogs; reads service via Events
|
||||
```
|
||||
|
||||
@@ -4,6 +4,16 @@ All notable GoSentry changes are recorded in this file.
|
||||
|
||||
## Unreleased
|
||||
|
||||
**Settings:**
|
||||
|
||||
- The **Logs directory** row gained an **Open** button that shows the folder in
|
||||
the desktop file manager (Explorer on Windows, the XDG handler on Linux), so
|
||||
reading a log file no longer means copying the path by hand. It opens the
|
||||
path currently in the field — including an edit that has not been saved yet —
|
||||
resolving a relative directory against the application folder exactly as the
|
||||
store does. A folder that is missing (the logs directory is created on the
|
||||
first run) or cannot be opened is reported in a dialog.
|
||||
|
||||
**Job dialog:**
|
||||
|
||||
- The **Arguments** placeholder now states the field's rule — one argument per
|
||||
|
||||
@@ -379,6 +379,33 @@ Tests pure History tab helpers (no Fyne widget construction).
|
||||
|
||||
---
|
||||
|
||||
### src/platform/filemanager/filemanager_test.go
|
||||
|
||||
**Package:** `filemanager`
|
||||
|
||||
Tests the guards around opening a folder in the desktop file manager. The
|
||||
success path is not tested: it would open a real file manager window.
|
||||
|
||||
| Test | Purpose |
|
||||
|------|---------|
|
||||
| `TestOpenRejectsMissingFolder` | Verifies that `Open` reports a missing directory (naming the path) instead of launching a handler. |
|
||||
| `TestOpenRejectsFile` | Verifies that `Open` refuses a path that is a file rather than a directory. |
|
||||
| `TestOpenCommandNamesPlatformHandler` | Verifies the per-platform handler (`explorer` / `xdg-open`, none elsewhere) and that the path is passed as one argument. |
|
||||
|
||||
---
|
||||
|
||||
### src/ui/settings_view_test.go
|
||||
|
||||
**Package:** `ui`
|
||||
|
||||
Tests pure Settings tab helpers (no Fyne widget construction).
|
||||
|
||||
| Test | Purpose |
|
||||
|------|---------|
|
||||
| `TestSettingsFolderPath` | Verifies the folder the Logs directory "Open" button targets: blank text yields no path, a relative path resolves against the application directory, an absolute path is used as typed. |
|
||||
|
||||
---
|
||||
|
||||
### src/ui/mainwindow_test.go
|
||||
|
||||
**Package:** `ui`
|
||||
|
||||
Reference in New Issue
Block a user