Version.cpp 546 B

123456789101112131415161718192021222324252627
  1. /*
  2. * Copyright (c) 2021, Mahmoud Mandour <ma.mandourr@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <AK/String.h>
  7. #include <LibCore/System.h>
  8. #include <LibCore/Version.h>
  9. namespace Core::Version {
  10. ErrorOr<String> read_long_version_string()
  11. {
  12. #ifdef AK_OS_SERENITY
  13. auto uname = TRY(Core::System::uname());
  14. auto const* version = uname.release;
  15. auto const* git_hash = uname.version;
  16. return String::formatted("Version {} revision {}", version, git_hash);
  17. #else
  18. return "Version 1.0"_string;
  19. #endif
  20. }
  21. }