Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/command/help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};
}
Expand Down
11 changes: 9 additions & 2 deletions src/help_button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

#include "help_button.h"

#include "git_version.h"

#include "format.h"

#include <libaegisub/exception.h>
Expand Down Expand Up @@ -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));
}
Loading