mirror of
https://github.com/denoland/deno.git
synced 2024-11-04 08:54:20 -05:00
69303e2149
This a complex boring PR that shifts around code (primarily) in cli/fs.rs and cli/ops/fs.rs. The gain of this refactoring is to ease the way for #4188 and #4017, and also to avoid some future development pain. Mostly there is no change in functionality. Except: * squashed bugs where op_utime and op_chown weren't using `resolve_from_cwd` * eliminated the use of the external `remove_dir_all` crate. * op_chmod now only queries metadata to verify file/dir exists on Windows (it will already fail on Unix if it doesn't) * op_chown now verifies the file/dir's existence on Windows like chmod does.
26 lines
667 B
TypeScript
26 lines
667 B
TypeScript
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
|
import { sendSync, sendAsync } from "../dispatch_json.ts";
|
|
import * as util from "../../util.ts";
|
|
import { build } from "../../build.ts";
|
|
|
|
export function symlinkSync(
|
|
oldpath: string,
|
|
newpath: string,
|
|
type?: string
|
|
): void {
|
|
if (build.os === "win" && type) {
|
|
return util.notImplemented();
|
|
}
|
|
sendSync("op_symlink", { oldpath, newpath });
|
|
}
|
|
|
|
export async function symlink(
|
|
oldpath: string,
|
|
newpath: string,
|
|
type?: string
|
|
): Promise<void> {
|
|
if (build.os === "win" && type) {
|
|
return util.notImplemented();
|
|
}
|
|
await sendAsync("op_symlink", { oldpath, newpath });
|
|
}
|