Skip to content

Commit ad3c048

Browse files
committed
Refactor code structure for improved readability and maintainability
1 parent 307c1db commit ad3c048

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

screenshots/feature-1.png

20.8 KB
Loading

screenshots/feature-7.png

359 KB
Loading

src-tauri/src/management/management_index.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,8 +575,16 @@ fn scan_single_aircraft_folder(
575575
}
576576

577577
fn rescan_aircraft_folder_entry(xplane_path: &Path, folder_name: &str) -> Result<AircraftInfo> {
578+
// Validate path (existence + traversal check). The canonical path it
579+
// returns is intentionally discarded: scan_single_aircraft_folder derives
580+
// the relative folder_name via strip_prefix against a non-canonical base,
581+
// and on Windows a canonical path carries a `\\?\` prefix that breaks the
582+
// match — the fallback would then return the full absolute path as
583+
// folder_name, causing duplicate entries in the UI list after a toggle.
584+
resolve_management_path(xplane_path, "aircraft", folder_name)?;
585+
578586
let aircraft_path = xplane_path.join("Aircraft");
579-
let folder_path = resolve_management_path(xplane_path, "aircraft", folder_name)?;
587+
let folder_path = aircraft_path.join(folder_name);
580588
let display_name = folder_path
581589
.file_name()
582590
.and_then(|name| name.to_str())

0 commit comments

Comments
 (0)