mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-22 18:15:14 +00:00
43 lines
1.3 KiB
C++
43 lines
1.3 KiB
C++
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#include <string>
|
|
|
|
#include "common/scm_rev.h"
|
|
|
|
namespace Common {
|
|
|
|
constexpr char g_version[] = "@APP_VERSION@";
|
|
constexpr bool g_is_release = @APP_IS_RELEASE@;
|
|
|
|
constexpr char g_scm_rev[] = "@GIT_REV@";
|
|
constexpr char g_scm_branch[] = "@GIT_BRANCH@";
|
|
constexpr char g_scm_desc[] = "@GIT_DESC@";
|
|
constexpr char g_scm_remote_name[] = "@GIT_REMOTE_NAME@";
|
|
constexpr char g_scm_remote_url[] = "@GIT_REMOTE_URL@";
|
|
constexpr char g_scm_date[] = "@BUILD_DATE@";
|
|
|
|
const std::string GetRemoteNameFromLink() {
|
|
std::string remote_url(Common::g_scm_remote_url);
|
|
std::string remote_host;
|
|
try {
|
|
if (remote_url.starts_with("http")) {
|
|
if (*remote_url.rbegin() == '/') {
|
|
remote_url.pop_back();
|
|
}
|
|
remote_host = remote_url.substr(19, remote_url.rfind('/') - 19);
|
|
} else if (remote_url.starts_with("git@")) {
|
|
auto after_comma_pos = remote_url.find(':') + 1, slash_pos = remote_url.find('/');
|
|
remote_host = remote_url.substr(after_comma_pos, slash_pos - after_comma_pos);
|
|
} else {
|
|
remote_host = "unknown";
|
|
}
|
|
} catch (...) {
|
|
remote_host = "unknown";
|
|
}
|
|
return remote_host;
|
|
}
|
|
|
|
} // namespace
|
|
|