Skip to content

Commit d36a06e

Browse files
committed
Support AppGetChromeVersionString and AppGetProductVersionString on Linux
AppGetProductVersionString uses a newly created version_linux.h file including only a APP_VERSION constant as there seems to be no other way to retrieve version number on Linux.
1 parent d59fad4 commit d36a06e

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

appshell/appshell_helpers_gtk.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#include "appshell/browser/resource.h"
2727
#include "appshell/common/client_switches.h"
28+
#include "appshell/version_linux.h"
2829
#include "include/cef_base.h"
2930
#include "include/cef_version.h"
3031

@@ -114,13 +115,18 @@ CefString AppGetCachePath() {
114115
}
115116

116117
CefString AppGetProductVersionString() {
117-
// TODO
118-
return CefString("");
118+
std::string s = APP_NAME "/" APP_VERSION;
119+
CefString ret;
120+
ret.FromString(s);
121+
return ret;
119122
}
120123

121124
CefString AppGetChromiumVersionString() {
122-
// TODO
123-
return CefString("");
125+
std::wostringstream versionStream(L"");
126+
versionStream << L"Chrome/" << cef_version_info(2) << L"." << cef_version_info(3)
127+
<< L"." << cef_version_info(4) << L"." << cef_version_info(5);
128+
129+
return CefString(versionStream.str());
124130
}
125131

126132
char* AppInitWorkingDirectory() {

appshell/version_linux.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#define APP_VERSION "1.9.0.0"

tasks/set-release.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ module.exports = function (grunt) {
4949
buildInstallerScriptPath = "installer/mac/buildInstaller.sh",
5050
versionRcPath = "appshell/version.rc",
5151
infoPlistPath = "appshell/mac/Info.plist",
52+
linuxVersionFile = "appshell/version_linux.h",
5253
release = grunt.option("release") || "",
5354
text,
5455
newVersion;
@@ -113,5 +114,14 @@ module.exports = function (grunt) {
113114
"$1" + newVersion.version + "$3"
114115
);
115116
grunt.file.write(infoPlistPath, text);
117+
118+
// 6. Open appshell/version_linux.h and change `APP_VERSION`
119+
text = grunt.file.read(linuxVersionFile);
120+
text = safeReplace(
121+
text,
122+
/APP_VERSION "(\d+\.\d+\.\d+\.\d+)"/,
123+
'APP_VERSION "' + newVersion.major + "." + newVersion.minor + "." + newVersion.patch + "." + (newVersion.build.length ? newVersion.build : "0") + '"'
124+
);
125+
grunt.file.write(linuxVersionFile, text);
116126
});
117127
};

0 commit comments

Comments
 (0)