summaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-12-26 10:05:58 +0200
committerLars Wirzenius <liw@liw.fi>2020-12-26 10:26:58 +0200
commit62b533e319f8a67db908a541c48b2d3a25edeb58 (patch)
tree866cae345a0c76538f0ff07df01f4c16e69e6bb2 /src/cmd
parent6cf8ec1898e70ba3e625f647f3dc3bf3f820299a (diff)
downloadobnam2-62b533e319f8a67db908a541c48b2d3a25edeb58.tar.gz
refactor: rename FileSystemEntry::path to pathbuf
This is a step towards changing how filenames are stored in FileSystemEntry.
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/backup.rs5
-rw-r--r--src/cmd/restore.rs11
2 files changed, 9 insertions, 7 deletions
diff --git a/src/cmd/backup.rs b/src/cmd/backup.rs
index 3303566..2a294f5 100644
--- a/src/cmd/backup.rs
+++ b/src/cmd/backup.rs
@@ -30,8 +30,9 @@ pub fn backup(config: &ClientConfig, buffer_size: usize) -> anyhow::Result<()> {
match entry {
Err(err) => Err(err),
Ok(entry) => {
- info!("backup: {}", entry.path().display());
- progress.set_message(&format!("{}", entry.path().display()));
+ let path = &entry.pathbuf();
+ info!("backup: {}", path.display());
+ progress.set_message(&format!("{}", path.display()));
client.upload_filesystem_entry(entry, buffer_size)
}
}
diff --git a/src/cmd/restore.rs b/src/cmd/restore.rs
index b4a8f2b..da654fd 100644
--- a/src/cmd/restore.rs
+++ b/src/cmd/restore.rs
@@ -81,7 +81,7 @@ fn restore_generation(
progress: &ProgressBar,
) -> anyhow::Result<()> {
debug!("restoring {:?}", entry);
- progress.set_message(&format!("{}", entry.path().display()));
+ progress.set_message(&format!("{}", entry.pathbuf().display()));
progress.inc(1);
let to = restored_path(entry, to)?;
@@ -112,10 +112,11 @@ fn restore_directory_metadata(entry: &FilesystemEntry, to: &Path) -> anyhow::Res
}
fn restored_path(entry: &FilesystemEntry, to: &Path) -> anyhow::Result<PathBuf> {
- let path = if entry.path().is_absolute() {
- entry.path().strip_prefix("/")?
+ let path = &entry.pathbuf();
+ let path = if path.is_absolute() {
+ path.strip_prefix("/")?
} else {
- entry.path()
+ path
};
Ok(to.join(path))
}
@@ -158,7 +159,7 @@ fn restore_symlink(path: &Path, entry: &FilesystemEntry) -> anyhow::Result<()> {
}
fn restore_metadata(path: &Path, entry: &FilesystemEntry) -> anyhow::Result<()> {
- debug!("restoring metadata for {}", entry.path().display());
+ debug!("restoring metadata for {}", entry.pathbuf().display());
let handle = File::open(path)?;