Skip to content

Commit

Permalink
posix_path
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-shandar committed Mar 12, 2024
1 parent 4556941 commit 180b92c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions blockset-lib/src/app/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mod add;
mod add_entry;

use std::io::{self, ErrorKind, Read, Write};
use std::io::{self, Cursor, ErrorKind, Read, Write};

use add_entry::add_entry;

Expand All @@ -21,6 +21,8 @@ use crate::{
uint::u224::U224,
};

use self::add::posix_path;

fn set_progress(
state: &mut StatusLine<'_, impl Io>,
display_new: bool,
Expand Down Expand Up @@ -140,13 +142,10 @@ pub fn run(io: &impl Io) -> io::Result<()> {
"add" => add_entry(io, &mut a, &|io| ForestTreeAdd::new(FileForest(io)), true),
"get" => {
let d = get_hash(&mut a)?;
let path = a.next().ok_or(invalid_input("missing file name"))?;
let path = posix_path(a.next().ok_or(invalid_input("missing file name"))?.as_str());
let w = &mut io.create(&path)?;
FileForest(io).restore(&ForestNodeId::new(NodeType::Root, &d), w, io)
}
"get-dir" => {
Ok(())
}
"info" => stdout.println(["size: ", calculate_total(io)?.to_string().as_str(), " B."]),
_ => Err(invalid_input("unknown command")),
}
Expand Down

0 comments on commit 180b92c

Please sign in to comment.