All fields are always returned
This commit is contained in:
parent
60ba2d624e
commit
25538fe7fb
1 changed files with 9 additions and 28 deletions
|
@ -98,37 +98,18 @@ mate::Dictionary ReadShortcutLink(v8::Isolate* isolate,
|
||||||
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;
|
base::win::ScopedCOMInitializer com_initializer;
|
||||||
// We have to call ResolveShortcutProperties one by one for each property
|
|
||||||
// because the API doesn't allow us to only get existing properties.
|
|
||||||
base::win::ShortcutProperties properties;
|
base::win::ShortcutProperties properties;
|
||||||
if (base::win::ResolveShortcutProperties(
|
if (!base::win::ResolveShortcutProperties(
|
||||||
path, ShortcutProperties::PROPERTIES_TARGET, &properties)) {
|
path, ShortcutProperties::PROPERTIES_ALL, &properties)) {
|
||||||
options.Set("target", properties.target);
|
|
||||||
} else {
|
|
||||||
// No need to continue if it doesn't even have a target.
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
if (base::win::ResolveShortcutProperties(
|
options.Set("target", properties.target);
|
||||||
path, ShortcutProperties::PROPERTIES_WORKING_DIR, &properties)) {
|
options.Set("cwd", properties.working_dir);
|
||||||
options.Set("cwd", properties.working_dir);
|
options.Set("args", properties.arguments);
|
||||||
}
|
options.Set("description", properties.description);
|
||||||
if (base::win::ResolveShortcutProperties(
|
options.Set("icon", properties.icon);
|
||||||
path, ShortcutProperties::PROPERTIES_ARGUMENTS, &properties)) {
|
options.Set("iconIndex", properties.icon_index);
|
||||||
options.Set("args", properties.arguments);
|
options.Set("appUserModelId", properties.app_id);
|
||||||
}
|
|
||||||
if (base::win::ResolveShortcutProperties(
|
|
||||||
path, ShortcutProperties::PROPERTIES_DESCRIPTION, &properties)) {
|
|
||||||
options.Set("description", properties.description);
|
|
||||||
}
|
|
||||||
if (base::win::ResolveShortcutProperties(
|
|
||||||
path, ShortcutProperties::PROPERTIES_ICON, &properties)) {
|
|
||||||
options.Set("icon", properties.icon);
|
|
||||||
options.Set("iconIndex", properties.icon_index);
|
|
||||||
}
|
|
||||||
if (base::win::ResolveShortcutProperties(
|
|
||||||
path, ShortcutProperties::PROPERTIES_ICON, &properties)) {
|
|
||||||
options.Set("appUserModelId", properties.app_id);
|
|
||||||
}
|
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue