forked from solana-labs/solana
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Revert "Ledger-tool: only require ledger dir when necessary (…
…backport solana-labs#21575) (solana-labs#21578)"" This reverts commit eae3166.
- Loading branch information
Tyera Eulberg
committed
Dec 16, 2021
1 parent
ede67ee
commit 5c5ae13
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.