fix: Windows File-Explorer – Backslashes und Laufwerksübersicht

Pfade werden auf Windows nativ mit Backslashes zurückgegeben statt zu Forward-Slashes konvertiert. Navigation von Laufwerk (C:) zurück zur Laufwerksliste ermöglicht.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
MelekiandClaude Opus 4.6 committed 2026-04-17 09:37:06 +02:00
1 parent 53cee67bef
commit eccecf8f14
2 files changed
+14 -12

No files matched your search

+10 -8
View File
@@ -579,10 +579,11 @@ async function fbLoadDir(absPath) {
sidebar.innerHTML = '<div class="fe-empty">Leer</div>';
}
const currentNorm = data.current.replace(/\/+$/, '');
const currentNorm = data.current.replace(/[\\/]+$/, '');
const atBase = _feState.basePath && currentNorm === _feState.basePath;
const atRoot = currentNorm === '' || currentNorm === '/' || (serverIsWindows && /^[A-Z]:$/i.test(currentNorm));
document.getElementById('feBack').disabled = atBase || (atRoot && _feState.history.length === 0);
const atDriveList = serverIsWindows && currentNorm === '';
const atRoot = currentNorm === '' || currentNorm === '/';
document.getElementById('feBack').disabled = atBase || (atRoot && _feState.history.length === 0) || atDriveList;
} catch (e) {
sidebar.innerHTML = '<div class="fe-error">Netzwerk-Fehler</div>';
}
@@ -591,13 +592,13 @@ async function fbLoadDir(absPath) {
function fbGoBack() {
if (!_feState) return;
// Nicht über den basePath hinaus navigieren
const currentNorm = _feState.currentAbsPath.replace(/\/+$/, '');
const currentNorm = _feState.currentAbsPath.replace(/[\\/]+$/, '');
if (_feState.basePath && currentNorm === _feState.basePath) return;
if (_feState.history.length > 0) {
const prev = _feState.history.pop();
// Prüfe ob der vorherige Pfad über dem basePath liegt
if (_feState.basePath && !prev.replace(/\/+$/, '').startsWith(_feState.basePath)) {
if (_feState.basePath && !prev.replace(/[\\/]+$/, '').startsWith(_feState.basePath)) {
_feState.history.length = 0;
fbLoadDir(_feState.basePath);
return;
@@ -608,10 +609,11 @@ function fbGoBack() {
let parent;
if (serverIsWindows && /^[A-Z]:$/i.test(currentNorm)) {
parent = ''; // Laufwerk → zurück zur Laufwerksauswahl
} else if (serverIsWindows && /^[A-Z]:\/[^/]*$/i.test(currentNorm)) {
parent = currentNorm.substring(0, 2); // z.B. C:/Users → C:
} else if (serverIsWindows && /^[A-Z]:[\\\/][^\\\/]*$/i.test(currentNorm)) {
parent = currentNorm.substring(0, 2); // z.B. C:\Users → C:
} else {
parent = currentNorm.includes('/') ? currentNorm.substring(0, currentNorm.lastIndexOf('/')) || (serverIsWindows ? '' : '/') : (serverIsWindows ? '' : '/');
const lastSep = Math.max(currentNorm.lastIndexOf('/'), currentNorm.lastIndexOf('\\'));
parent = lastSep > 0 ? currentNorm.substring(0, lastSep) : (serverIsWindows ? '' : '/');
}
if (parent !== currentNorm) {
fbLoadDir(parent);