From 75e660f78e8672280872f6800126185d07143688 Mon Sep 17 00:00:00 2001 From: bbedward Date: Wed, 17 Sep 2025 09:25:43 -0400 Subject: [PATCH] ensure file:// prefix is trimmed from notepad --- Services/NotepadStorageService.qml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Services/NotepadStorageService.qml b/Services/NotepadStorageService.qml index 5a93e643..bdf581b2 100644 --- a/Services/NotepadStorageService.qml +++ b/Services/NotepadStorageService.qml @@ -8,7 +8,13 @@ pragma ComponentBehavior: Bound Singleton { id: root - readonly property string baseDir: StandardPaths.writableLocation(StandardPaths.GenericStateLocation) + "/DankMaterialShell" + readonly property string baseDir: { + var path = StandardPaths.writableLocation(StandardPaths.GenericStateLocation) + "/DankMaterialShell" + if (path.startsWith("file://")) { + return path.substring(7) + } + return path + } readonly property string filesDir: baseDir + "/notepad-files" readonly property string metadataPath: baseDir + "/notepad-session.json" @@ -321,13 +327,8 @@ Singleton { } function createEmptyFile(path, callback) { - // Ensure path is a local file path, not a URL var cleanPath = path.toString() - if (cleanPath.startsWith("file://")) { - cleanPath = cleanPath.substring(7) - } - // Validate the cleaned path is absolute and in the right location if (!cleanPath.startsWith("/")) { cleanPath = baseDir + "/" + cleanPath }