MCPcopy
hub / github.com/codedogQBY/ReadAny / move

Method move

packages/core/src/sync/lan-server.ts:276–289  ·  view source on GitHub ↗
(fromPath: string, toPath: string)

Source from the content-addressed store, hash-verified

274 }
275
276 async move(fromPath: string, toPath: string): Promise<void> {
277 // TODO: platform.renameFile would be more efficient; degrade to read+write+delete
278 // for now since LAN sync is currently one-way and this rarely runs in practice.
279 const platform = getPlatformService();
280 const adapter = getSyncAdapter();
281 const fromResolved = await this.mapVirtualPath(fromPath);
282 const toResolved = await this.mapVirtualPath(toPath);
283 if (fromResolved === toResolved) return;
284 const destDir = toResolved.substring(0, toResolved.lastIndexOf("/"));
285 if (destDir) await adapter.ensureDir(destDir);
286 const data = await platform.readFile(fromResolved);
287 await platform.writeFile(toResolved, data);
288 await platform.deleteFile(fromResolved);
289 }
290
291 async exists(path: string): Promise<boolean> {
292 if (path.startsWith(`${LAN_SYNC_DIR}/device-`) && path.endsWith(".json")) {

Callers

nothing calls this directly

Calls 7

mapVirtualPathMethod · 0.95
getPlatformServiceFunction · 0.90
getSyncAdapterFunction · 0.90
ensureDirMethod · 0.65
readFileMethod · 0.65
writeFileMethod · 0.65
deleteFileMethod · 0.65

Tested by

no test coverage detected