Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions dist/virtualfs-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -18897,7 +18897,7 @@ let $f1a90a4a391136ce$var$preferNodeWs = false, $f1a90a4a391136ce$var$forceNodeW
options = options || {
multiple: false
};
if (!options.defaultPath) options.defaultPath = await globalObject.electronAPI.documentDir();
if (!options.defaultPath) options.defaultPath = await globalObject.electronFSAPI.documentDir();
const dialogOptions = {
defaultPath: options.defaultPath,
title: options.title,
Expand All @@ -18908,7 +18908,7 @@ let $f1a90a4a391136ce$var$preferNodeWs = false, $f1a90a4a391136ce$var$forceNodeW
if (options.multiple) dialogOptions.properties.push("multiSelections");
if (options.filters) dialogOptions.filters = options.filters;
try {
const filePaths = await globalObject.electronAPI.showOpenDialog(dialogOptions);
const filePaths = await globalObject.electronFSAPI.showOpenDialog(dialogOptions);
if (!filePaths || filePaths.length === 0) return null;
if (options.multiple) return filePaths.map((p)=>$f1a90a4a391136ce$require$Utils.getTauriVirtualPath(p));
return $f1a90a4a391136ce$require$Utils.getTauriVirtualPath(filePaths[0]);
Expand All @@ -18927,14 +18927,14 @@ let $f1a90a4a391136ce$var$preferNodeWs = false, $f1a90a4a391136ce$var$forceNodeW
* @returns {Promise<string|null>} A promise that resolves to the selected file path or null.
*/ async function $f1a90a4a391136ce$var$openElectronFileSaveDialogueAsync(options) {
options = options || {};
if (!options.defaultPath) options.defaultPath = await globalObject.electronAPI.documentDir();
if (!options.defaultPath) options.defaultPath = await globalObject.electronFSAPI.documentDir();
const dialogOptions = {
defaultPath: options.defaultPath,
title: options.title
};
if (options.filters) dialogOptions.filters = options.filters;
try {
const filePath = await globalObject.electronAPI.showSaveDialog(dialogOptions);
const filePath = await globalObject.electronFSAPI.showSaveDialog(dialogOptions);
if (typeof filePath === "string" && filePath) return $f1a90a4a391136ce$require$Utils.getTauriVirtualPath(filePath);
return null;
} catch (err) {
Expand All @@ -18943,7 +18943,7 @@ let $f1a90a4a391136ce$var$preferNodeWs = false, $f1a90a4a391136ce$var$forceNodeW
}
async function $f1a90a4a391136ce$var$_getElectronStat(vfsPath) {
const platformPath = globalObject.fs.getTauriPlatformPath(vfsPath);
const stats = await $f1a90a4a391136ce$var$unwrapFsResult(globalObject.electronAPI.fsStat(platformPath));
const stats = await $f1a90a4a391136ce$var$unwrapFsResult(globalObject.electronFSAPI.fsStat(platformPath));
return $f1a90a4a391136ce$require$Utils.createFromNodeStat(vfsPath, stats, $f1a90a4a391136ce$require$Constants.ELECTRON_DEVICE_NAME);
}
function $f1a90a4a391136ce$var$_readDirHelper(entries, path, options, callback, useDummyStats) {
Expand Down Expand Up @@ -18976,7 +18976,7 @@ function $f1a90a4a391136ce$var$_readDirHelper(entries, path, options, callback,
return;
}
const platformPath = $f1a90a4a391136ce$require$Utils.getTauriPlatformPath(path);
$f1a90a4a391136ce$var$unwrapFsResult(globalObject.electronAPI.fsReaddir(platformPath)).then((entries)=>{
$f1a90a4a391136ce$var$unwrapFsResult(globalObject.electronFSAPI.fsReaddir(platformPath)).then((entries)=>{
$f1a90a4a391136ce$var$_readDirHelper(entries, path, options, callback);
}).catch((err)=>{
callback($f1a90a4a391136ce$var$mapNodeErrorMessage(err, path, "Failed to read directory: "));
Expand All @@ -19000,7 +19000,7 @@ function $f1a90a4a391136ce$var$_readDirHelper(entries, path, options, callback,
return;
}
const platformPath = $f1a90a4a391136ce$require$Utils.getTauriPlatformPath(path);
$f1a90a4a391136ce$var$unwrapFsResult(globalObject.electronAPI.fsMkdir(platformPath, {
$f1a90a4a391136ce$var$unwrapFsResult(globalObject.electronFSAPI.fsMkdir(platformPath, {
recursive: recursive,
mode: mode
})).then(()=>{
Expand Down Expand Up @@ -19028,12 +19028,12 @@ function $f1a90a4a391136ce$var$unlink(path, callback) {
}
$f1a90a4a391136ce$var$_getElectronStat(path).then((stat)=>{
const platformPath = $f1a90a4a391136ce$require$Utils.getTauriPlatformPath(path);
if (stat.isDirectory()) $f1a90a4a391136ce$var$unwrapFsResult(globalObject.electronAPI.fsRmdir(platformPath, {
if (stat.isDirectory()) $f1a90a4a391136ce$var$unwrapFsResult(globalObject.electronFSAPI.fsRmdir(platformPath, {
recursive: true
})).then(()=>{
callback(null);
}).catch(errCallback);
else $f1a90a4a391136ce$var$unwrapFsResult(globalObject.electronAPI.fsUnlink(platformPath)).then(()=>{
else $f1a90a4a391136ce$var$unwrapFsResult(globalObject.electronFSAPI.fsUnlink(platformPath)).then(()=>{
callback(null);
}).catch(errCallback);
}).catch(errCallback);
Expand All @@ -19047,7 +19047,7 @@ function $f1a90a4a391136ce$var$rename(oldPath, newPath, callback) {
}
const oldPlatformPath = $f1a90a4a391136ce$require$Utils.getTauriPlatformPath(oldPath);
const newPlatformPath = $f1a90a4a391136ce$require$Utils.getTauriPlatformPath(newPath);
$f1a90a4a391136ce$var$unwrapFsResult(globalObject.electronAPI.fsRename(oldPlatformPath, newPlatformPath)).then(()=>{
$f1a90a4a391136ce$var$unwrapFsResult(globalObject.electronFSAPI.fsRename(oldPlatformPath, newPlatformPath)).then(()=>{
callback(null);
}).catch((err)=>{
callback($f1a90a4a391136ce$var$mapNodeErrorMessage(err, oldPath, `Failed to rename ${oldPath} to ${newPath}`));
Expand Down Expand Up @@ -19089,7 +19089,7 @@ function $f1a90a4a391136ce$var$rename(oldPath, newPath, callback) {
return;
}
const platformPath = $f1a90a4a391136ce$require$Utils.getTauriPlatformPath(path);
$f1a90a4a391136ce$var$unwrapFsResult(globalObject.electronAPI.fsReadFile(platformPath)).then((contents)=>{
$f1a90a4a391136ce$var$unwrapFsResult(globalObject.electronFSAPI.fsReadFile(platformPath)).then((contents)=>{
// Electron returns a Buffer, convert to ArrayBuffer
let arrayBuffer;
if (contents instanceof ArrayBuffer) arrayBuffer = contents;
Expand Down Expand Up @@ -19131,7 +19131,7 @@ function $f1a90a4a391136ce$var$rename(oldPath, newPath, callback) {
const platformPath = $f1a90a4a391136ce$require$Utils.getTauriPlatformPath(path);
// Convert ArrayBuffer to Uint8Array for IPC transfer
const uint8Array = new Uint8Array(arrayBuffer);
$f1a90a4a391136ce$var$unwrapFsResult(globalObject.electronAPI.fsWriteFile(platformPath, Array.from(uint8Array))).then(()=>{
$f1a90a4a391136ce$var$unwrapFsResult(globalObject.electronFSAPI.fsWriteFile(platformPath, Array.from(uint8Array))).then(()=>{
callback(null);
}).catch((err)=>{
callback($f1a90a4a391136ce$var$mapNodeErrorMessage(err, path, `Failed to write File at path ${path}`));
Expand Down
2 changes: 1 addition & 1 deletion dist/virtualfs-debug.js.map

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions dist/virtualfs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/virtualfs.js.map

Large diffs are not rendered by default.

Loading
Loading