Skip to content

Commit 87eb664

Browse files
committed
vfs: remove create_or_open helpers, use CreateDirAll in open_dir instead of CreateDir
1 parent b1907fe commit 87eb664

File tree

2 files changed

+1
-23
lines changed

2 files changed

+1
-23
lines changed

src/vfs/directory.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub fn open_dir(path: &str, create: bool, timeout: Option<u64>) -> Result<Direct
6767
});
6868
}
6969

70-
let message = vfs_request(path, VfsAction::CreateDir)
70+
let message = vfs_request(path, VfsAction::CreateDirAll)
7171
.send_and_await_response(timeout)
7272
.unwrap()
7373
.map_err(|e| VfsError::IOError {
@@ -88,17 +88,6 @@ pub fn open_dir(path: &str, create: bool, timeout: Option<u64>) -> Result<Direct
8888
}
8989
}
9090

91-
/// Open or create a directory at path.
92-
pub fn open_or_create_dir(path: &str) -> Result<Directory, VfsError> {
93-
match open_dir(path, false, None) {
94-
Ok(dir) => Ok(dir),
95-
Err(_) => match open_dir(path, true, None) {
96-
Ok(dir) => Ok(dir),
97-
Err(e) => Err(e),
98-
},
99-
}
100-
}
101-
10291
/// Removes a dir at path, errors if path not found or path is not a directory.
10392
pub fn remove_dir(path: &str, timeout: Option<u64>) -> Result<(), VfsError> {
10493
let timeout = timeout.unwrap_or(5);

src/vfs/file.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -377,17 +377,6 @@ pub fn open_file(path: &str, create: bool, timeout: Option<u64>) -> Result<File,
377377
}
378378
}
379379

380-
/// Open or create a file at path.
381-
pub fn open_or_create_file(path: &str) -> Result<File, VfsError> {
382-
match open_file(path, false, None) {
383-
Ok(file) => Ok(file),
384-
Err(_) => match open_file(path, true, None) {
385-
Ok(file) => Ok(file),
386-
Err(e) => Err(e),
387-
},
388-
}
389-
}
390-
391380
/// Creates a file at path, if file found at path, truncates it to 0.
392381
pub fn create_file(path: &str, timeout: Option<u64>) -> Result<File, VfsError> {
393382
let timeout = timeout.unwrap_or(5);

0 commit comments

Comments
 (0)