This repository has been archived by the owner on Jan 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…#21578) * Ledger-tool: only require ledger dir when necessary (#21575) * Don't canonicalize ledger_path unless ledger_path will be used * Single use statement (cherry picked from commit 2b269db) # Conflicts: # ledger-tool/src/main.rs * Fix conflicts Co-authored-by: Tyera Eulberg <[email protected]> Co-authored-by: Tyera Eulberg <[email protected]>
- Loading branch information
1 parent
416fccf
commit 5a7b487
Showing
3 changed files
with
1,496 additions
and
1,442 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,30 @@ | ||
use { | ||
clap::{value_t, ArgMatches}, | ||
std::{ | ||
fs, | ||
path::{Path, PathBuf}, | ||
process::exit, | ||
}, | ||
}; | ||
|
||
pub fn parse_ledger_path(matches: &ArgMatches<'_>, name: &str) -> PathBuf { | ||
PathBuf::from(value_t!(matches, name, String).unwrap_or_else(|_err| { | ||
eprintln!( | ||
"Error: Missing --ledger <DIR> argument.\n\n{}", | ||
matches.usage() | ||
); | ||
exit(1); | ||
})) | ||
} | ||
|
||
// Canonicalize ledger path to avoid issues with symlink creation | ||
pub fn canonicalize_ledger_path(ledger_path: &Path) -> PathBuf { | ||
fs::canonicalize(&ledger_path).unwrap_or_else(|err| { | ||
eprintln!( | ||
"Unable to access ledger path '{}': {}", | ||
ledger_path.display(), | ||
err | ||
); | ||
exit(1); | ||
}) | ||
} |
Oops, something went wrong.