Initialize COM before using the API
This commit is contained in:
parent
7f3443b138
commit
60ba2d624e
1 changed files with 3 additions and 0 deletions
|
@ -12,6 +12,7 @@
|
||||||
#include "native_mate/dictionary.h"
|
#include "native_mate/dictionary.h"
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
|
#include "base/win/scoped_com_initializer.h"
|
||||||
#include "base/win/shortcut.h"
|
#include "base/win/shortcut.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -87,6 +88,7 @@ bool WriteShortcutLink(const base::FilePath& shortcut_path,
|
||||||
if (options.Get("appUserModelId", &str))
|
if (options.Get("appUserModelId", &str))
|
||||||
properties.set_app_id(str);
|
properties.set_app_id(str);
|
||||||
|
|
||||||
|
base::win::ScopedCOMInitializer com_initializer;
|
||||||
return base::win::CreateOrUpdateShortcutLink(
|
return base::win::CreateOrUpdateShortcutLink(
|
||||||
shortcut_path, properties, operation);
|
shortcut_path, properties, operation);
|
||||||
}
|
}
|
||||||
|
@ -95,6 +97,7 @@ mate::Dictionary ReadShortcutLink(v8::Isolate* isolate,
|
||||||
const base::FilePath& path) {
|
const base::FilePath& path) {
|
||||||
using base::win::ShortcutProperties;
|
using base::win::ShortcutProperties;
|
||||||
mate::Dictionary options = mate::Dictionary::CreateEmpty(isolate);
|
mate::Dictionary options = mate::Dictionary::CreateEmpty(isolate);
|
||||||
|
base::win::ScopedCOMInitializer com_initializer;
|
||||||
// We have to call ResolveShortcutProperties one by one for each property
|
// We have to call ResolveShortcutProperties one by one for each property
|
||||||
// because the API doesn't allow us to only get existing properties.
|
// because the API doesn't allow us to only get existing properties.
|
||||||
base::win::ShortcutProperties properties;
|
base::win::ShortcutProperties properties;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue