mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-13 00:42:49 -05:00
ensure file:// prefix is trimmed from notepad
This commit is contained in:
@@ -8,7 +8,13 @@ pragma ComponentBehavior: Bound
|
|||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
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 filesDir: baseDir + "/notepad-files"
|
||||||
readonly property string metadataPath: baseDir + "/notepad-session.json"
|
readonly property string metadataPath: baseDir + "/notepad-session.json"
|
||||||
|
|
||||||
@@ -321,13 +327,8 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createEmptyFile(path, callback) {
|
function createEmptyFile(path, callback) {
|
||||||
// Ensure path is a local file path, not a URL
|
|
||||||
var cleanPath = path.toString()
|
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("/")) {
|
if (!cleanPath.startsWith("/")) {
|
||||||
cleanPath = baseDir + "/" + cleanPath
|
cleanPath = baseDir + "/" + cleanPath
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user