mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-28 21:38:03 +03:00
Fix ccrash if remote is not set (#2291)
This commit is contained in:
parent
b5d63a31cc
commit
be74f65864
3 changed files with 14 additions and 6 deletions
|
@ -106,21 +106,27 @@ git_describe(GIT_DESC --always --long --dirty)
|
||||||
git_branch_name(GIT_BRANCH)
|
git_branch_name(GIT_BRANCH)
|
||||||
string(TIMESTAMP BUILD_DATE "%Y-%m-%d %H:%M:%S")
|
string(TIMESTAMP BUILD_DATE "%Y-%m-%d %H:%M:%S")
|
||||||
|
|
||||||
# Get current remote name and branch
|
# Try to get the upstream remote and branch
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND git rev-parse --abbrev-ref --symbolic-full-name @{u}
|
COMMAND git rev-parse --abbrev-ref --symbolic-full-name @{u}
|
||||||
OUTPUT_VARIABLE GIT_REMOTE_NAME
|
OUTPUT_VARIABLE GIT_REMOTE_NAME
|
||||||
RESULT_VARIABLE GIT_BRANCH_RESULT
|
RESULT_VARIABLE GIT_BRANCH_RESULT
|
||||||
|
ERROR_QUIET
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
|
|
||||||
# Default to origin if branch is not set
|
# Default to origin if there's no upstream set or if the command failed
|
||||||
if (GIT_BRANCH_RESULT OR GIT_REMOTE_NAME STREQUAL "")
|
if (GIT_BRANCH_RESULT OR GIT_REMOTE_NAME STREQUAL "")
|
||||||
set(GIT_REMOTE_NAME "origin")
|
set(GIT_REMOTE_NAME "origin")
|
||||||
else()
|
else()
|
||||||
# Extract remote name from full name
|
# Extract remote name if the output contains a remote/branch format
|
||||||
string(FIND "${GIT_REMOTE_NAME}" "/" INDEX)
|
string(FIND "${GIT_REMOTE_NAME}" "/" INDEX)
|
||||||
string(SUBSTRING "${GIT_REMOTE_NAME}" 0 "${INDEX}" GIT_REMOTE_NAME)
|
if (INDEX GREATER -1)
|
||||||
|
string(SUBSTRING "${GIT_REMOTE_NAME}" 0 "${INDEX}" GIT_REMOTE_NAME)
|
||||||
|
else()
|
||||||
|
# If no remote is present (only a branch name), default to origin
|
||||||
|
set(GIT_REMOTE_NAME "origin")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Get remote link
|
# Get remote link
|
||||||
|
|
|
@ -201,7 +201,8 @@ void Emulator::Run(const std::filesystem::path& file, const std::vector<std::str
|
||||||
window_title = fmt::format("shadPS4 v{} | {}", Common::VERSION, game_title);
|
window_title = fmt::format("shadPS4 v{} | {}", Common::VERSION, game_title);
|
||||||
} else {
|
} else {
|
||||||
std::string remote_url(Common::g_scm_remote_url);
|
std::string remote_url(Common::g_scm_remote_url);
|
||||||
if (remote_url == "https://github.com/shadps4-emu/shadPS4.git") {
|
if (remote_url == "https://github.com/shadps4-emu/shadPS4.git" ||
|
||||||
|
remote_url.length() == 0) {
|
||||||
window_title = fmt::format("shadPS4 v{} {} {} | {}", Common::VERSION,
|
window_title = fmt::format("shadPS4 v{} {} {} | {}", Common::VERSION,
|
||||||
Common::g_scm_branch, Common::g_scm_desc, game_title);
|
Common::g_scm_branch, Common::g_scm_desc, game_title);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -58,7 +58,8 @@ bool MainWindow::Init() {
|
||||||
window_title = fmt::format("shadPS4 v{}", Common::VERSION);
|
window_title = fmt::format("shadPS4 v{}", Common::VERSION);
|
||||||
} else {
|
} else {
|
||||||
std::string remote_url(Common::g_scm_remote_url);
|
std::string remote_url(Common::g_scm_remote_url);
|
||||||
if (remote_url == "https://github.com/shadps4-emu/shadPS4.git") {
|
if (remote_url == "https://github.com/shadps4-emu/shadPS4.git" ||
|
||||||
|
remote_url.length() == 0) {
|
||||||
window_title = fmt::format("shadPS4 v{} {} {}", Common::VERSION, Common::g_scm_branch,
|
window_title = fmt::format("shadPS4 v{} {} {}", Common::VERSION, Common::g_scm_branch,
|
||||||
Common::g_scm_desc);
|
Common::g_scm_desc);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue