chore: fix chrome

This commit is contained in:
2026-04-15 11:40:45 +02:00
parent ea968b8492
commit dc706d6262
10 changed files with 112 additions and 32 deletions

42
src/fs/File.ts Normal file
View File

@@ -0,0 +1,42 @@
import { Directory } from "./Directory"
export class File {
readonly location: Directory
readonly name: string
readonly path: string
private data: any
constructor(path: string) {
this.path = path
const match = path.match(/^(\/[^\/]*)+\/?$/gm)
if (!match)
throw new SyntaxError("Bad filepath")
this.location = new Directory(match[0])
this.name = match[1]
new Directory(path)
console.log(this.location)
console.log(this.name)
}
Exists(): boolean {
return window.localStorage.getItem(this.path) !== null && window.localStorage.getItem(this.path) !== undefined
}
Remove() {
window.localStorage.removeItem(this.path)
}
Write(data: any) {
this.data = data
window.localStorage.setItem(this.path, JSON.stringify(this))
}
Read(): any {
return this.data
}
}