summaryrefslogtreecommitdiff
path: root/cli/ops/files.rs
diff options
context:
space:
mode:
authordubiousjim <dubiousjim@gmail.com>2020-03-06 11:29:23 -0500
committerGitHub <noreply@github.com>2020-03-06 11:29:23 -0500
commitacf0958e940f8c668c9f34dc780da48d8963a1e7 (patch)
tree69816ce683e0b369e2c7b6566cc249255a39953d /cli/ops/files.rs
parentbb3d9c8280912f6e30692477aeb5331fb359d993 (diff)
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`.
Diffstat (limited to 'cli/ops/files.rs')
-rw-r--r--cli/ops/files.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/cli/ops/files.rs b/cli/ops/files.rs
index b8ca7a229..842ee5b39 100644
--- a/cli/ops/files.rs
+++ b/cli/ops/files.rs
@@ -22,7 +22,7 @@ pub fn init(i: &mut Isolate, s: &State) {
#[serde(rename_all = "camelCase")]
struct OpenArgs {
promise_id: Option<u64>,
- filename: String,
+ path: String,
options: Option<OpenOptions>,
mode: Option<String>,
}
@@ -45,17 +45,17 @@ fn op_open(
_zero_copy: Option<ZeroCopyBuf>,
) -> Result<JsonOp, OpError> {
let args: OpenArgs = serde_json::from_value(args)?;
- let filename = deno_fs::resolve_from_cwd(Path::new(&args.filename))?;
+ let path = deno_fs::resolve_from_cwd(Path::new(&args.path))?;
let state_ = state.clone();
let mut open_options = tokio::fs::OpenOptions::new();
if let Some(options) = args.options {
if options.read {
- state.check_read(&filename)?;
+ state.check_read(&path)?;
}
if options.write || options.append {
- state.check_write(&filename)?;
+ state.check_write(&path)?;
}
open_options
@@ -69,14 +69,14 @@ fn op_open(
let mode = mode.as_ref();
match mode {
"r" => {
- state.check_read(&filename)?;
+ state.check_read(&path)?;
}
"w" | "a" | "x" => {
- state.check_write(&filename)?;
+ state.check_write(&path)?;
}
&_ => {
- state.check_read(&filename)?;
- state.check_write(&filename)?;
+ state.check_read(&path)?;
+ state.check_write(&path)?;
}
};
@@ -123,7 +123,7 @@ fn op_open(
let is_sync = args.promise_id.is_none();
let fut = async move {
- let fs_file = open_options.open(filename).await?;
+ let fs_file = open_options.open(path).await?;
let mut state = state_.borrow_mut();
let rid = state.resource_table.add(
"fsFile",