MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / create_file

Method create_file

atomic-repository/src/archive.rs:727–749  ·  view source on GitHub ↗
(
        &mut self,
        path: &str,
        _size: u64,
        _mode: u32,
        _mtime: u64,
    )

Source from the content-addressed store, hash-verified

725 type Error = io::Error;
726
727 fn create_file(
728 &mut self,
729 path: &str,
730 _size: u64,
731 _mode: u32,
732 _mtime: u64,
733 ) -> Result<Self::Writer, Self::Error> {
734 let full_path = self.root.join(path);
735
736 // Ensure parent directory exists
737 if let Some(parent) = full_path.parent() {
738 if !self.created_dirs.contains(parent) {
739 std::fs::create_dir_all(parent)?;
740 self.created_dirs.insert(parent.to_path_buf());
741 }
742 }
743
744 let file = std::fs::File::create(&full_path)?;
745 Ok(DirectoryFile {
746 file,
747 path: full_path,
748 })
749 }
750
751 fn create_directory(&mut self, path: &str, _mode: u32, _mtime: u64) -> Result<(), Self::Error> {
752 let full_path = self.root.join(path);

Calls 3

parentMethod · 0.80
containsMethod · 0.45
insertMethod · 0.45