(
ctx: MemoryScopeContext,
virtualPath: string,
actor: MemoryActor
)
| 808 | } |
| 809 | |
| 810 | async deletePath( |
| 811 | ctx: MemoryScopeContext, |
| 812 | virtualPath: string, |
| 813 | actor: MemoryActor |
| 814 | ): Promise<MemoryCommandResult> { |
| 815 | return this.runCommand(async () => { |
| 816 | const parsed = parseMemoryPath(virtualPath); |
| 817 | const scope = this.requireFilePath(parsed, virtualPath); |
| 818 | const store = await this.resolveStore(ctx, scope, parsed.relPath); |
| 819 | return this.locks.withLock(store.physicalRoot, async () => { |
| 820 | const kind = await store.kind(parsed.relPath); |
| 821 | if (kind === null) { |
| 822 | throw new MemoryCommandError(`No memory file or directory at ${virtualPath}`); |
| 823 | } |
| 824 | await store.remove(parsed.relPath); |
| 825 | await this.recordDelete(ctx, scope, parsed.relPath); |
| 826 | this.emitChange(ctx, scope, parsed.relPath, actor); |
| 827 | return { |
| 828 | success: true as const, |
| 829 | output: `Deleted ${toVirtualPath(scope, parsed.relPath)}`, |
| 830 | }; |
| 831 | }); |
| 832 | }); |
| 833 | } |
| 834 | |
| 835 | async rename( |
| 836 | ctx: MemoryScopeContext, |
no test coverage detected