Skip to content

Commit

Permalink
fix open online template location
Browse files Browse the repository at this point in the history
  • Loading branch information
octaeder committed Feb 24, 2024
1 parent e042ab3 commit c0021fb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/templateselector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,17 @@ void TemplateSelector::removeTemplate()
void TemplateSelector::openTemplateLocation()
{
TemplateHandle th = selectedTemplate();
QString url = "file:///" + QFileInfo(th.file()).absolutePath();
QString url = th.file();
QString proto = url;
proto.truncate(8);
if (proto=="https://") {
url.replace(0, QString( "https://raw.githubusercontent.com/texstudio-org/texstudio-template/main").size(),
"https://github.com/texstudio-org/texstudio-template/tree/main");
url.truncate(url.lastIndexOf("/"));
}
else {
url = "file:///" + QFileInfo(th.file()).absolutePath();
}
if (!QDesktopServices::openUrl(QUrl(url))) {
UtilsUi::txsCritical(tr("Could not open location:") + QString("\n%1").arg(url));
}
Expand Down

0 comments on commit c0021fb

Please sign in to comment.