win: Fix assertion when getting exe version
This commit is contained in:
parent
82452e7924
commit
de93b30d3c
1 changed files with 2 additions and 0 deletions
|
@ -20,6 +20,7 @@
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
|
#include "base/threading/thread_restrictions.h"
|
||||||
#include "base/win/registry.h"
|
#include "base/win/registry.h"
|
||||||
#include "base/win/win_util.h"
|
#include "base/win/win_util.h"
|
||||||
#include "base/win/windows_version.h"
|
#include "base/win/windows_version.h"
|
||||||
|
@ -334,6 +335,7 @@ PCWSTR Browser::GetAppUserModelID() {
|
||||||
std::string Browser::GetExecutableFileVersion() const {
|
std::string Browser::GetExecutableFileVersion() const {
|
||||||
base::FilePath path;
|
base::FilePath path;
|
||||||
if (PathService::Get(base::FILE_EXE, &path)) {
|
if (PathService::Get(base::FILE_EXE, &path)) {
|
||||||
|
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||||
std::unique_ptr<FileVersionInfo> version_info(
|
std::unique_ptr<FileVersionInfo> version_info(
|
||||||
FileVersionInfo::CreateFileVersionInfo(path));
|
FileVersionInfo::CreateFileVersionInfo(path));
|
||||||
return base::UTF16ToUTF8(version_info->product_version());
|
return base::UTF16ToUTF8(version_info->product_version());
|
||||||
|
|
Loading…
Reference in a new issue