-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
parity/upgrade.rs
Outdated
@@ -105,7 +105,9 @@ fn upgrade_from_version(previous_version: &Version) -> Result<usize, Error> { | |||
fn with_locked_version<F>(db_path: Option<&str>, script: F) -> Result<usize, Error> | |||
where F: Fn(&Version) -> Result<usize, Error> | |||
{ | |||
let mut path = db_path.map_or({ | |||
let mut path = db_path.map_or_else(|| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me like the db_path
is always is_some()
(with_locked_version
is only used in upgrade
, and db_path
in upgrade
is always Some
). Maybe we can remove map_or_else
altogether, or am I wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're right.
It turns out that this code doesn't work in practice (we get a panic on Android), so I'll work a bit more on it. |
The code is now working. Parity runs even if you don't have |
@@ -205,6 +201,10 @@ fn upgrade_user_defaults(dirs: &DatabaseDirectories) { | |||
} | |||
|
|||
pub fn upgrade_data_paths(base_path: &str, dirs: &DatabaseDirectories, pruning: Algorithm) { | |||
if env::home_dir().is_none() { | |||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make make sense to print a warning here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. The function only does something if $HOME/.parity
exists, and doesn't print any warning if it doesn't. If $HOME
isn't defined we behave exactly as if $HOME/.parity
doesn't exist.
…rp_sync_on_light_client * 'master' of https://github.com/paritytech/parity: ethcore: add transition flag for transaction permission contract (openethereum#9275) Remove all dapp permissions related settings (openethereum#9120) Improve return data truncate logic (openethereum#9254) Update wasm-tests hash (openethereum#9295) Implement KIP4: create2 for wasm (openethereum#9277) Fix loop start value (openethereum#9285) Avoid using $HOME if not necessary (openethereum#9273) Fix path to parity.h (openethereum#9274)
When Parity is used within an Android application, the
$HOME
environment variable isn't set. This will cause Parity to panic.This commit fixes it by avoiding to load the value of
$HOME
if it is not required.