Add platform method to return executable(bundle)'s version.
This commit is contained in:
parent
c9e9080a35
commit
a79649c43f
2 changed files with 11 additions and 0 deletions
|
@ -30,6 +30,9 @@ class Browser : public WindowListObserver {
|
|||
// Focus the application.
|
||||
void Focus();
|
||||
|
||||
// Returns the version of the executable (or bundle).
|
||||
std::string GetVersion();
|
||||
|
||||
// Tell the application to open a file.
|
||||
bool OpenFile(const std::string& file_path);
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include "browser/browser.h"
|
||||
|
||||
#import "base/mac/bundle_locations.h"
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#import "browser/atom_application_mac.h"
|
||||
|
||||
namespace atom {
|
||||
|
@ -16,4 +18,10 @@ void Browser::Focus() {
|
|||
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
|
||||
}
|
||||
|
||||
std::string Browser::GetVersion() {
|
||||
NSDictionary* infoDictionary = base::mac::OuterBundle().infoDictionary;
|
||||
NSString *version = [infoDictionary objectForKey:@"CFBundleVersion"];
|
||||
return base::SysNSStringToUTF8(version);
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
|
Loading…
Add table
Reference in a new issue