-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: refact code structure for platform specific behavior
- Loading branch information
Showing
2 changed files
with
30 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use std::path::Path; | ||
|
||
use libc::mode_t; | ||
|
||
use crate::driver::op::Op; | ||
|
||
pub(super) struct BuilderInner { | ||
mode: libc::mode_t, | ||
} | ||
|
||
impl BuilderInner { | ||
pub(super) fn new() -> Self { | ||
Self { mode: 0o777 } | ||
} | ||
|
||
pub(super) async fn mkdir(&self, path: &Path) -> std::io::Result<()> { | ||
Op::mkdir(path, self.mode)?.await.meta.result.map(|_| ()) | ||
} | ||
|
||
pub(super) fn set_mode(&mut self, mode: u32) { | ||
self.mode = mode as mode_t; | ||
} | ||
} |