esv: remove invalid path checks
They're catering to too much of an edge case. It can just be checked with std.file.exists() later on.
This commit is contained in:
parent
bf3eb2953a
commit
f540160ff3
1 changed files with 1 additions and 5 deletions
6
esv.d
6
esv.d
|
@ -24,7 +24,7 @@ import std.conv : to, ConvException;
|
||||||
import std.file : exists, mkdirRecurse, write, FileException;
|
import std.file : exists, mkdirRecurse, write, FileException;
|
||||||
import std.format : format;
|
import std.format : format;
|
||||||
import std.getopt : getopt, GetOptException;
|
import std.getopt : getopt, GetOptException;
|
||||||
import std.path : baseName, dirName, expandTilde, isValidPath;
|
import std.path : baseName, dirName, expandTilde;
|
||||||
import std.process : environment, executeShell;
|
import std.process : environment, executeShell;
|
||||||
import std.stdio : writeln, writefln;
|
import std.stdio : writeln, writefln;
|
||||||
import std.string : splitLines;
|
import std.string : splitLines;
|
||||||
|
@ -107,12 +107,8 @@ config:
|
||||||
.expandTilde();
|
.expandTilde();
|
||||||
try {
|
try {
|
||||||
if (CFlag != "") { /* if -C was given */
|
if (CFlag != "") { /* if -C was given */
|
||||||
enforceDie(CFlag.isValidPath(), CFlag ~ ": invalid path");
|
|
||||||
configPath = CFlag.expandTilde();
|
configPath = CFlag.expandTilde();
|
||||||
} else {
|
} else {
|
||||||
enforceDie(configPath.isValidPath(),
|
|
||||||
configPath ~ ": invalid path");
|
|
||||||
|
|
||||||
if (!configPath.exists()) {
|
if (!configPath.exists()) {
|
||||||
mkdirRecurse(dirName(configPath));
|
mkdirRecurse(dirName(configPath));
|
||||||
configPath.write(format!
|
configPath.write(format!
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue