Skip to content

Commit 0bdb903

Browse files
committed
refactor: match name with tauri api for documentDir
1 parent 4d98840 commit 0bdb903

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

src-electron/preload.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ contextBridge.exposeInMainWorld('electronAPI', {
2020
// CLI and paths
2121
getCliArgs: () => ipcRenderer.invoke('get-cli-args'),
2222
getAppPath: () => ipcRenderer.invoke('get-app-path'),
23-
getDocumentsDir: () => ipcRenderer.invoke('get-documents-dir'),
23+
documentDir: () => ipcRenderer.invoke('get-documents-dir'),
2424
appLocalDataDir: () => ipcRenderer.invoke('get-app-data-dir'),
2525
getWindowsDrives: () => ipcRenderer.invoke('get-windows-drives'),
2626
showOpenDialog: (options) => ipcRenderer.invoke('show-open-dialog', options),

src/fslib_electron.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ async function openElectronFilePickerAsync(options) {
9999
options = options || { multiple: false };
100100

101101
if (!options.defaultPath) {
102-
options.defaultPath = await globalObject.electronAPI.getDocumentsDir();
102+
options.defaultPath = await globalObject.electronAPI.documentDir();
103103
}
104104

105105
const dialogOptions = {
@@ -150,7 +150,7 @@ async function openElectronFileSaveDialogueAsync(options) {
150150
options = options || {};
151151

152152
if (!options.defaultPath) {
153-
options.defaultPath = await globalObject.electronAPI.getDocumentsDir();
153+
options.defaultPath = await globalObject.electronAPI.documentDir();
154154
}
155155

156156
const dialogOptions = {

test/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
}
8686
// Electron detection and setup
8787
if(window.electronAPI){
88-
window.electronAPI.getDocumentsDir().then(d => console.log("Electron documentsDir:", d));
88+
window.electronAPI.documentDir().then(d => console.log("Electron documentsDir:", d));
8989
window.electronAPI.appLocalDataDir().then(d => console.log("Electron appDataDir:", d));
9090
window.electronAPI.getAppPath().then(appPath => {
9191
const nodeSrcPath = appPath + "/../src-tauri/node-src/index.js";

0 commit comments

Comments
 (0)