mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:37:36 +00:00
LibCore: Add default version for Lagom applications
Instead of grabbing `uname -vr` on non-Serenity platforms, let's just hardcode a version. This prevents Lagom builds of applications like Shell or Ladybird from reporting their version as that of the host OS.
This commit is contained in:
parent
39e79d6f6f
commit
b7f9634f6c
2 changed files with 6 additions and 0 deletions
|
@ -383,6 +383,8 @@ void ArgsParser::print_usage_markdown(FILE* file, StringView argv0)
|
|||
|
||||
void ArgsParser::print_version(FILE* file)
|
||||
{
|
||||
// FIXME: Allow applications to override version string for --version.
|
||||
// Especially useful for Lagom applications
|
||||
outln(file, Core::Version::read_long_version_string().release_value_but_fixme_should_propagate_errors());
|
||||
}
|
||||
|
||||
|
|
|
@ -12,12 +12,16 @@ namespace Core::Version {
|
|||
|
||||
ErrorOr<String> read_long_version_string()
|
||||
{
|
||||
#ifdef AK_OS_SERENITY
|
||||
auto uname = TRY(Core::System::uname());
|
||||
|
||||
auto const* version = uname.release;
|
||||
auto const* git_hash = uname.version;
|
||||
|
||||
return String::formatted("Version {} revision {}", version, git_hash);
|
||||
#else
|
||||
return String::from_utf8("Version 1.0"sv);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue