Use environment.get()'s second default value argument instead of using null checks
This commit is contained in:
parent
dcb847578d
commit
3751040fe0
1 changed files with 4 additions and 5 deletions
9
main.d
9
main.d
|
@ -120,13 +120,12 @@ int main(string[] args)
|
|||
configPath = optConfigPath.expandTilde();
|
||||
else
|
||||
panic(optConfigPath ~ ": invalid file path");
|
||||
} else if (configEnvVar !is null) {
|
||||
if (configEnvVar.isValidPath())
|
||||
configPath = configEnvVar.expandTilde();
|
||||
} else {
|
||||
configPath = environment.get(ENV_CONFIG, DEFAULT_CONFIGPATH);
|
||||
if (configPath.isValidPath())
|
||||
configPath = configPath.expandTilde();
|
||||
else
|
||||
panic(configEnvVar ~ ": invalid file path");
|
||||
} else {
|
||||
configPath = DEFAULT_CONFIGPATH.expandTilde();
|
||||
if (!configPath.exists()) {
|
||||
configPath.write(
|
||||
"# Default esv configuration file.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue