Jelajahi Sumber

Add path shortcut resolution

Introduce a pathShortcuts map and resolvePathShortcut(path) helper to expand user-friendly shortcuts (e.g. "%appdata%" -> "user:/.appdata/"). Integrate resolution into listDirectory so paths provided with shortcuts are normalized before directory listing. This enables using predefined shortcut tokens when opening folders.
Toby Chui 2 minggu lalu
induk
melakukan
54f38be50c
1 mengubah file dengan 14 tambahan dan 0 penghapusan
  1. 14 0
      src/web/SystemAO/file_system/file_explorer.html

+ 14 - 0
src/web/SystemAO/file_system/file_explorer.html

@@ -889,8 +889,22 @@
                 return [icon, name];
             }
 
+            // ============================== PATH SHORTCUT RESOLUTION ====================
+            var pathShortcuts = {
+                "%appdata%": "user:/.appdata/",
+            };
+
+            function resolvePathShortcut(path){
+                var lower = path.trim().toLowerCase();
+                if (pathShortcuts[lower] !== undefined){
+                    return pathShortcuts[lower];
+                }
+                return path;
+            }
+
             // ============================== FOLDER LISTING FUNCTIONS ====================
             function listDirectory(path, callback=undefined, recordUndo=true){
+                path = resolvePathShortcut(path);
                 enableAutoRefresh = false;
                 var recordPreviousPage = true;
                 if (recordUndo == false){