(fromPath: string, toPath: string)
| 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")) { |
nothing calls this directly
no test coverage detected