@@ -18232,6 +18232,7 @@ const $17476582ace0b2bc$var$WS_COMMAND = {
1823218232 WRITE_BIN_FILE: "writeBinFile",
1823318233 MKDIR: "mkdir",
1823418234 RENAME: "rename",
18235+ COPY: "copy",
1823518236 UNLINK: "unlink",
1823618237 WATCH: "watch",
1823718238 UNWATCH: "unwatch"
@@ -18664,6 +18665,18 @@ function $17476582ace0b2bc$var$unlink(path, callback) {
1866418665 });
1866518666 });
1866618667}
18668+ async function $17476582ace0b2bc$var$copy(src, dst, callback) {
18669+ const srcPlatformPath = $17476582ace0b2bc$require$Utils.getTauriPlatformPath(src);
18670+ const dstPlatformPath = $17476582ace0b2bc$require$Utils.getTauriPlatformPath(dst);
18671+ $17476582ace0b2bc$var$_execCommand($17476582ace0b2bc$var$WS_COMMAND.COPY, {
18672+ src: srcPlatformPath,
18673+ dst: dstPlatformPath
18674+ }).then(({ metadata: metadata })=>{
18675+ callback(null, $17476582ace0b2bc$require$Utils.getTauriVirtualPath(metadata.data.copiedPath));
18676+ }).catch((err)=>{
18677+ callback($17476582ace0b2bc$var$mapNodeTauriErrorMessage(err, src, `Failed to copy: ${src} to ${dst}`));
18678+ });
18679+ }
1866718680const $17476582ace0b2bc$var$NodeTauriFS = {
1866818681 testNodeWsEndpoint: $17476582ace0b2bc$var$testNodeWsEndpoint,
1866918682 setNodeWSEndpoint: $17476582ace0b2bc$var$setNodeWSEndpoint,
@@ -18678,7 +18691,8 @@ const $17476582ace0b2bc$var$NodeTauriFS = {
1867818691 rename: $17476582ace0b2bc$var$rename,
1867918692 unlink: $17476582ace0b2bc$var$unlink,
1868018693 watchAsync: $17476582ace0b2bc$var$watchAsync,
18681- unwatchAsync: $17476582ace0b2bc$var$unwatchAsync
18694+ unwatchAsync: $17476582ace0b2bc$var$unwatchAsync,
18695+ copy: $17476582ace0b2bc$var$copy
1868218696};
1868318697$17476582ace0b2bc$exports = {
1868418698 NodeTauriFS: $17476582ace0b2bc$var$NodeTauriFS
@@ -19159,6 +19173,19 @@ function $d1f4f8cce920e9b9$var$rename(oldPath, newPath, callback) {
1915919173 if (!$d1f4f8cce920e9b9$require$NodeTauriFS.getNodeWSEndpoint()) throw new Error("Please call fs.setNodeWSEndpoint('ws://your server') before calling this function.");
1916019174 $d1f4f8cce920e9b9$var$preferNodeWs = use;
1916119175}
19176+ function $d1f4f8cce920e9b9$var$canCopy() {
19177+ // we can only copy if node tari fs is ready as tauri doesn't have folder copy apis.
19178+ return $d1f4f8cce920e9b9$require$NodeTauriFS.isNodeWSReady();
19179+ }
19180+ async function $d1f4f8cce920e9b9$var$copy(src, dst, callback) {
19181+ if (!$d1f4f8cce920e9b9$var$canCopy()) {
19182+ callback(new $d1f4f8cce920e9b9$require$Errors.EIO(`IO error while copying: ${src} to ${dst}, node not ready.`, src));
19183+ return;
19184+ }
19185+ src = globalObject.path.normalize(src);
19186+ dst = globalObject.path.normalize(dst);
19187+ return $d1f4f8cce920e9b9$require$NodeTauriFS.copy(src, dst, callback);
19188+ }
1916219189const $d1f4f8cce920e9b9$var$TauriFS = {
1916319190 isTauriPath: $d1f4f8cce920e9b9$require$Utils.isTauriPath,
1916419191 isTauriSubPath: $d1f4f8cce920e9b9$require$Utils.isTauriSubPath,
@@ -19174,7 +19201,9 @@ const $d1f4f8cce920e9b9$var$TauriFS = {
1917419201 rename: $d1f4f8cce920e9b9$var$rename,
1917519202 unlink: $d1f4f8cce920e9b9$var$unlink,
1917619203 readFile: $d1f4f8cce920e9b9$var$readFile,
19177- writeFile: $d1f4f8cce920e9b9$var$writeFile
19204+ writeFile: $d1f4f8cce920e9b9$var$writeFile,
19205+ copy: $d1f4f8cce920e9b9$var$copy,
19206+ canCopy: $d1f4f8cce920e9b9$var$canCopy
1917819207};
1917919208$d1f4f8cce920e9b9$exports = {
1918019209 TauriFS: $d1f4f8cce920e9b9$var$TauriFS
@@ -20328,6 +20357,7 @@ const $e3f139c5065f0041$var$fileSystemLib = {
2032820357 // spawn different threads in rust and write tauri handlers which is pretty complex atm. so instead we will
2032920358 // fall back to global copy here and will use node Tauri web socket fs adapter as and when it becomes available.
2033020359 if ($e3f139c5065f0041$require$Mounts.isMountSubPath(src) && $e3f139c5065f0041$require$Mounts.isMountSubPath(dst)) return $e3f139c5065f0041$require$NativeFS.copy(src, dst, callbackInterceptor);
20360+ else if ($e3f139c5065f0041$require$TauriFS.canCopy() && $e3f139c5065f0041$require$TauriFS.isTauriSubPath(src) && $e3f139c5065f0041$require$TauriFS.isTauriSubPath(dst)) return $e3f139c5065f0041$require$TauriFS.copy(src, dst, callbackInterceptor);
2033120361 else return $e3f139c5065f0041$require$globalCopy(src, dst, callbackInterceptor);
2033220362 },
2033320363 showSaveDialog: function(options) {
0 commit comments