Skip to content

Commit 1634479

Browse files
committed
fix: use correct config path
1 parent 54e75a7 commit 1634479

File tree

1 file changed

+10
-23
lines changed

1 file changed

+10
-23
lines changed

src/tool/ToolMain.cpp

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -58,33 +58,20 @@ getReferenceDirectories(std::string const& execPath)
5858
return Unexpected(formatError("Unable to determine current working directory: {}", ec.message()));
5959
}
6060
dirs.cwd = std::string(cwd.data(), cwd.size());
61-
std::string configPath;
62-
if (toolArgs.config.getValue() != "")
63-
{
64-
configPath = toolArgs.config.getValue();
65-
}
66-
else
67-
{
68-
llvm::cl::list<std::string>& inputs = toolArgs.cmdLineInputs;
69-
for (auto& input: inputs)
70-
{
71-
if (files::getFileName(input) == "mrdocs.yml")
72-
{
73-
configPath = input;
74-
break;
75-
}
76-
}
77-
}
78-
if (configPath.empty())
61+
std::string configPath = toolArgs.config.getValue();
62+
63+
llvm::cl::list<std::string>& inputs = toolArgs.cmdLineInputs;
64+
for (auto& input : inputs)
7965
{
80-
if (files::exists("./mrdocs.yml"))
81-
{
82-
configPath = "./mrdocs.yml";
83-
}
66+
if (files::getFileName(input) == "mrdocs.yml")
67+
configPath = input;
8468
}
69+
8570
if (configPath.empty())
8671
{
87-
return Unexpected(formatError("The config path is missing"));
72+
if (! files::exists("./mrdocs.yml"))
73+
return Unexpected(formatError("The config path is missing"));
74+
configPath = "./mrdocs.yml";
8875
}
8976
configPath = files::makeAbsolute(configPath, dirs.cwd);
9077
return std::make_pair(configPath, dirs);

0 commit comments

Comments
 (0)