(sourcePath: string, targetPath: string)
| 53 | } |
| 54 | |
| 55 | async function moveFile(sourcePath: string, targetPath: string): Promise<void> { |
| 56 | try { |
| 57 | await rename(sourcePath, targetPath) |
| 58 | } catch (error) { |
| 59 | const isCrossDeviceMove = (error as NodeJS.ErrnoException).code === 'EXDEV' |
| 60 | if (!isCrossDeviceMove) { |
| 61 | throw error |
| 62 | } |
| 63 | |
| 64 | await copyFile(sourcePath, targetPath) |
| 65 | await unlink(sourcePath) |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | function resolveDirectoryWithinAttachmentsRoot(...segments: string[]): string { |
| 70 | const attachmentsRoot = getCurrentAttachmentsDirectory() |
no outgoing calls
no test coverage detected