Rename name/filename arguments to path (#4227)

There's a lot of variation in doc comments and internal code about
whether the first parameter to file system calls is `path` or `name` or
`filename`. For consistency, have made it always be `path`.
This commit is contained in:
dubiousjim 2020-03-06 11:29:23 -05:00 committed by GitHub
parent bb3d9c8280
commit acf0958e94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 111 additions and 114 deletions

View file

@ -8,19 +8,19 @@ function toSecondsFromEpoch(v: number | Date): number {
/** **UNSTABLE**: needs investigation into high precision time.
*
* Synchronously changes the access and modification times of a file system
* object referenced by `filename`. Given times are either in seconds
* (Unix epoch time) or as `Date` objects.
* object referenced by `path`. Given times are either in seconds (UNIX epoch
* time) or as `Date` objects.
*
* Deno.utimeSync("myfile.txt", 1556495550, new Date());
*
* Requires `allow-write` permission. */
export function utimeSync(
filename: string,
path: string,
atime: number | Date,
mtime: number | Date
): void {
sendSync("op_utime", {
filename,
path,
// TODO(ry) split atime, mtime into [seconds, nanoseconds] tuple
atime: toSecondsFromEpoch(atime),
mtime: toSecondsFromEpoch(mtime)
@ -30,19 +30,19 @@ export function utimeSync(
/** **UNSTABLE**: needs investigation into high precision time.
*
* Changes the access and modification times of a file system object
* referenced by `filename`. Given times are either in seconds
* (Unix epoch time) or as `Date` objects.
* referenced by `path`. Given times are either in seconds (UNIX epoch time)
* or as `Date` objects.
*
* await Deno.utime("myfile.txt", 1556495550, new Date());
*
* Requires `allow-write` permission. */
export async function utime(
filename: string,
path: string,
atime: number | Date,
mtime: number | Date
): Promise<void> {
await sendAsync("op_utime", {
filename,
path,
// TODO(ry) split atime, mtime into [seconds, nanoseconds] tuple
atime: toSecondsFromEpoch(atime),
mtime: toSecondsFromEpoch(mtime)