generated from nhcarrigan/template
fix: use backend command to read memory files for WSL compatibility
The frontend was using Tauri's `readTextFile` plugin which enforces scope restrictions and doesn't work with WSL paths on Windows. Changed to use our `read_file_content` backend command which: - Already handles WSL paths correctly on Windows - Works with absolute paths on all platforms - Bypasses Tauri's filesystem scope restrictions - Matches the pattern used throughout the app for file operations This fixes the "forbidden path" error when trying to read memory files on Windows whilst maintaining functionality on Linux/Mac. ✨ This fix was created by Hikari~ 🌸
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import { invoke } from "@tauri-apps/api/core";
|
import { invoke } from "@tauri-apps/api/core";
|
||||||
import { readTextFile } from "@tauri-apps/plugin-fs";
|
|
||||||
import Markdown from "./Markdown.svelte";
|
import Markdown from "./Markdown.svelte";
|
||||||
|
|
||||||
let memoryFiles: string[] = $state([]);
|
let memoryFiles: string[] = $state([]);
|
||||||
@@ -33,7 +32,8 @@
|
|||||||
isLoading = true;
|
isLoading = true;
|
||||||
error = null;
|
error = null;
|
||||||
try {
|
try {
|
||||||
const content = await readTextFile(filePath);
|
// Use our backend command instead of Tauri plugin to handle WSL paths
|
||||||
|
const content = await invoke<string>("read_file_content", { path: filePath });
|
||||||
fileContent = content;
|
fileContent = content;
|
||||||
selectedFile = filePath;
|
selectedFile = filePath;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user