mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 11:09:18 +00:00
Everywhere: Hoist the Libraries folder to the top-level
This commit is contained in:
parent
950e819ee7
commit
93712b24bf
Notes:
github-actions[bot]
2024-11-10 11:51:52 +00:00
Author: https://github.com/trflynn89
Commit: 93712b24bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
4547 changed files with 104 additions and 113 deletions
32
Libraries/LibCore/Version.cpp
Normal file
32
Libraries/LibCore/Version.cpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Mahmoud Mandour <ma.mandourr@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/Environment.h>
|
||||
#include <LibCore/Version.h>
|
||||
|
||||
namespace Core::Version {
|
||||
|
||||
ErrorOr<String> read_long_version_string()
|
||||
{
|
||||
auto validate_git_hash = [](auto hash) {
|
||||
if (hash.length() < 4 || hash.length() > 40)
|
||||
return false;
|
||||
for (auto ch : hash) {
|
||||
if (!is_ascii_hex_digit(ch))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
auto maybe_git_hash = Core::Environment::get("LADYBIRD_GIT_VERSION"sv);
|
||||
|
||||
if (maybe_git_hash.has_value() && validate_git_hash(maybe_git_hash.value()))
|
||||
return MUST(String::formatted("Version 1.0-{}", maybe_git_hash.value()));
|
||||
return "Version 1.0"_string;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue