Use bundle's name as application name when we have one.
This commit is contained in:
parent
a614134144
commit
fc4ed9be12
4 changed files with 29 additions and 2 deletions
|
@ -48,7 +48,13 @@ void Browser::SetVersion(const std::string& version) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Browser::GetName() const {
|
std::string Browser::GetName() const {
|
||||||
return name_override_.empty() ? "Atom-Shell" : name_override_;
|
if (name_override_.empty()) {
|
||||||
|
std::string name = GetExecutableFileProductName();
|
||||||
|
if (!name.empty())
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return name_override_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::SetName(const std::string& name) {
|
void Browser::SetName(const std::string& name) {
|
||||||
|
|
|
@ -80,6 +80,9 @@ class Browser : public WindowListObserver {
|
||||||
// Returns the version of application bundle or executable file.
|
// Returns the version of application bundle or executable file.
|
||||||
std::string GetExecutableFileVersion() const;
|
std::string GetExecutableFileVersion() const;
|
||||||
|
|
||||||
|
// Returns the name of application bundle or executable file.
|
||||||
|
std::string GetExecutableFileProductName() const;
|
||||||
|
|
||||||
// Send the will-quit message and then terminate the application.
|
// Send the will-quit message and then terminate the application.
|
||||||
void NotifyAndTerminate();
|
void NotifyAndTerminate();
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,12 @@ std::string Browser::GetExecutableFileVersion() const {
|
||||||
return base::SysNSStringToUTF8(version);
|
return base::SysNSStringToUTF8(version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Browser::GetExecutableFileProductName() const {
|
||||||
|
NSDictionary* infoDictionary = base::mac::OuterBundle().infoDictionary;
|
||||||
|
NSString *version = [infoDictionary objectForKey:@"CFBundleName"];
|
||||||
|
return base::SysNSStringToUTF8(version);
|
||||||
|
}
|
||||||
|
|
||||||
void Browser::CancelQuit() {
|
void Browser::CancelQuit() {
|
||||||
[[AtomApplication sharedApplication] replyToApplicationShouldTerminate:NO];
|
[[AtomApplication sharedApplication] replyToApplicationShouldTerminate:NO];
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "base/memory/scoped_ptr.h"
|
#include "base/memory/scoped_ptr.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
|
#include "common/atom_version.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
@ -51,7 +52,18 @@ std::string Browser::GetExecutableFileVersion() const {
|
||||||
return UTF16ToUTF8(version_info->product_version());
|
return UTF16ToUTF8(version_info->product_version());
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return ATOM_VERSION_STRING;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Browser::GetExecutableFileProductName() const {
|
||||||
|
base::FilePath path;
|
||||||
|
if (PathService::Get(base::FILE_EXE, &path)) {
|
||||||
|
scoped_ptr<FileVersionInfo> version_info(
|
||||||
|
FileVersionInfo::CreateFileVersionInfo(path));
|
||||||
|
return UTF16ToUTF8(version_info->product_name());
|
||||||
|
}
|
||||||
|
|
||||||
|
return "Atom-Shell";
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::CancelQuit() {
|
void Browser::CancelQuit() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue