diff --git a/src/command/help.cpp b/src/command/help.cpp index 9516ae29a8..d24fe2a59f 100644 --- a/src/command/help.cpp +++ b/src/command/help.cpp @@ -106,7 +106,7 @@ struct help_website final : public Command { STR_HELP("Visit Aegisub's official website") void operator()(agi::Context *) override { - wxLaunchDefaultBrowser("http://www.aegisub.org/", wxBROWSER_NEW_WINDOW); + wxLaunchDefaultBrowser("https://aegisub.org/", wxBROWSER_NEW_WINDOW); } }; } diff --git a/src/help_button.cpp b/src/help_button.cpp index 9c84686b79..8d005dd17a 100644 --- a/src/help_button.cpp +++ b/src/help_button.cpp @@ -29,6 +29,8 @@ #include "help_button.h" +#include "git_version.h" + #include "format.h" #include @@ -78,10 +80,15 @@ HelpButton::HelpButton(wxWindow *parent, const char *page, wxPoint position, wxS } void HelpButton::OpenPage(const char *pageID) { + // Returns the documentation version string based on the git version format. + // If BUILD_GIT_VERSION_STRING is exactly 5 characters, it is assumed to be a version like "3.2.2", and the semver major.minor is used. + // substr will brake if the minor version exceeds 9, but considering the history of the project this is acceptable. + // Otherwise, "latest" is used for the documentation version. + std::string version = strlen(BUILD_GIT_VERSION_STRING) == 5 ? std::string(BUILD_GIT_VERSION_STRING).substr(0, 3) : "latest"; auto page = url(pageID); auto sep = strchr(page, '#'); if (sep) - wxLaunchDefaultBrowser(fmt_wx("http://docs.aegisub.org/3.2/%.*s/%s", sep - page, page, sep)); + wxLaunchDefaultBrowser(fmt_wx("https://docs.aegisub.org/%s/%.*s/%s", version.c_str(), sep - page, page, sep)); else - wxLaunchDefaultBrowser(fmt_wx("http://docs.aegisub.org/3.2/%s/", page)); + wxLaunchDefaultBrowser(fmt_wx("https://docs.aegisub.org/%s/%s/", version.c_str(), page)); }