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();
|
configPath = optConfigPath.expandTilde();
|
||||||
else
|
else
|
||||||
panic(optConfigPath ~ ": invalid file path");
|
panic(optConfigPath ~ ": invalid file path");
|
||||||
} else if (configEnvVar !is null) {
|
} else {
|
||||||
if (configEnvVar.isValidPath())
|
configPath = environment.get(ENV_CONFIG, DEFAULT_CONFIGPATH);
|
||||||
configPath = configEnvVar.expandTilde();
|
if (configPath.isValidPath())
|
||||||
|
configPath = configPath.expandTilde();
|
||||||
else
|
else
|
||||||
panic(configEnvVar ~ ": invalid file path");
|
panic(configEnvVar ~ ": invalid file path");
|
||||||
} else {
|
|
||||||
configPath = DEFAULT_CONFIGPATH.expandTilde();
|
|
||||||
if (!configPath.exists()) {
|
if (!configPath.exists()) {
|
||||||
configPath.write(
|
configPath.write(
|
||||||
"# Default esv configuration file.
|
"# Default esv configuration file.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue