src/vs/platform/files/node/diskFileSystemProvider.ts/DiskFileSystemProvider/doCloneFile
class DiskFileSystemProvider:	private async doCloneFile(from: URI, to: URI, mkdir: boolean): Promise<void> {
		const fromFilePath = this.toFilePath(from);
		const toFilePath = this.toFilePath(to);

		const isPathCaseSensitive = !!(this.capabilities & FileSystemProviderCapabilities.PathCaseSensitive);
		if (isEqual(fromFilePath, toFilePath, !isPathCaseSensitive)) {
			return; // cloning is only supported `from` and `to` are different files
		}

		// Implement clone by using `fs.copyFile`, however setup locks
		// for both `from` and `to` because node.js does not ensure
		// this to be an atomic operation

		const locks = new DisposableStore();

		try {
			const [fromLock, toLock] = await Promise.all([
				this.createResourceLock(from),
				this.createResourceLock(to)
			]);

			locks.add(fromLock);
			locks.add(toLock);

			if (mkdir) {
				await Promises.mkdir(dirname(toFilePath), { recursive: true });
			}

			await Promises.copyFile(fromFilePath, toFilePath);
		} catch (error) {
			if (error.code === 'ENOENT' && !mkdir) {
				return this.doCloneFile(from, to, true);
			}

			throw this.toFileSystemProviderError(error);
		} finally {
			locks.dispose();
		}
	}