mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 15:47:45 +00:00
LibCore: Migrate Command from Deprecated{File,String}
This gives us free error-propagation in Core::command(...) and HackStudio::ProjectBuilder::for_each_library_dependencies. The comment about "String will be in the null state" has been misleading for a long time, so it is removed.
This commit is contained in:
parent
07dd719e3e
commit
f9a24eb7eb
4 changed files with 16 additions and 20 deletions
|
@ -80,10 +80,10 @@ DeprecatedString GitRepo::command(Vector<DeprecatedString> const& command_parts)
|
|||
|
||||
DeprecatedString GitRepo::command_wrapper(Vector<DeprecatedString> const& command_parts, DeprecatedString const& chdir)
|
||||
{
|
||||
auto result = Core::command("git", command_parts, LexicalPath(chdir));
|
||||
auto const result = Core::command("git", command_parts, LexicalPath(chdir));
|
||||
if (result.is_error() || result.value().exit_code != 0)
|
||||
return {};
|
||||
return result.value().output;
|
||||
return DeprecatedString(result.value().output.bytes());
|
||||
}
|
||||
|
||||
bool GitRepo::git_is_installed()
|
||||
|
|
|
@ -209,7 +209,7 @@ void ProjectBuilder::for_each_library_definition(Function<void(DeprecatedString,
|
|||
}
|
||||
|
||||
static Regex<ECMA262> const parse_library_definition(R"~~~(.+:serenity_lib[c]?\((\w+) (\w+)\).*)~~~");
|
||||
for (auto& line : res.value().output.split('\n')) {
|
||||
for (auto& line : StringView(res.value().output).split_view('\n')) {
|
||||
RegexResult result;
|
||||
if (!parse_library_definition.search(line, result))
|
||||
continue;
|
||||
|
@ -234,10 +234,10 @@ void ProjectBuilder::for_each_library_dependencies(Function<void(DeprecatedStrin
|
|||
warnln("{}", res.error());
|
||||
return;
|
||||
}
|
||||
auto libraries = StringView(res.value().output).split_view('\n');
|
||||
|
||||
static Regex<ECMA262> const parse_library_definition(R"~~~(.+:target_link_libraries\((\w+) ([\w\s]+)\).*)~~~");
|
||||
for (auto& line : res.value().output.split('\n')) {
|
||||
|
||||
for (auto& line : libraries) {
|
||||
RegexResult result;
|
||||
if (!parse_library_definition.search(line, result))
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue