From d36a06efe50d937702ee68398e0c50edab3bd24e Mon Sep 17 00:00:00 2001 From: ficristo Date: Sun, 23 Oct 2016 11:33:57 +0200 Subject: [PATCH] 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. --- appshell/appshell_helpers_gtk.cpp | 14 ++++++++++---- appshell/version_linux.h | 1 + tasks/set-release.js | 10 ++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 appshell/version_linux.h diff --git a/appshell/appshell_helpers_gtk.cpp b/appshell/appshell_helpers_gtk.cpp index 3f59440f9..8b2e51c40 100644 --- a/appshell/appshell_helpers_gtk.cpp +++ b/appshell/appshell_helpers_gtk.cpp @@ -25,6 +25,7 @@ #include "appshell/browser/resource.h" #include "appshell/common/client_switches.h" +#include "appshell/version_linux.h" #include "include/cef_base.h" #include "include/cef_version.h" @@ -114,13 +115,18 @@ CefString AppGetCachePath() { } CefString AppGetProductVersionString() { - // TODO - return CefString(""); + std::string s = APP_NAME "/" APP_VERSION; + CefString ret; + ret.FromString(s); + return ret; } CefString AppGetChromiumVersionString() { - // TODO - return CefString(""); + std::wostringstream versionStream(L""); + versionStream << L"Chrome/" << cef_version_info(2) << L"." << cef_version_info(3) + << L"." << cef_version_info(4) << L"." << cef_version_info(5); + + return CefString(versionStream.str()); } char* AppInitWorkingDirectory() { diff --git a/appshell/version_linux.h b/appshell/version_linux.h new file mode 100644 index 000000000..422dcd711 --- /dev/null +++ b/appshell/version_linux.h @@ -0,0 +1 @@ +#define APP_VERSION "1.9.0.0" diff --git a/tasks/set-release.js b/tasks/set-release.js index 35b32eec6..dac3eb361 100644 --- a/tasks/set-release.js +++ b/tasks/set-release.js @@ -49,6 +49,7 @@ module.exports = function (grunt) { buildInstallerScriptPath = "installer/mac/buildInstaller.sh", versionRcPath = "appshell/version.rc", infoPlistPath = "appshell/mac/Info.plist", + linuxVersionFile = "appshell/version_linux.h", release = grunt.option("release") || "", text, newVersion; @@ -113,5 +114,14 @@ module.exports = function (grunt) { "$1" + newVersion.version + "$3" ); grunt.file.write(infoPlistPath, text); + + // 6. Open appshell/version_linux.h and change `APP_VERSION` + text = grunt.file.read(linuxVersionFile); + text = safeReplace( + text, + /APP_VERSION "(\d+\.\d+\.\d+\.\d+)"/, + 'APP_VERSION "' + newVersion.major + "." + newVersion.minor + "." + newVersion.patch + "." + (newVersion.build.length ? newVersion.build : "0") + '"' + ); + grunt.file.write(linuxVersionFile, text); }); };