From 25538fe7fb8dc4f7c800661a36fb08160e446ccf Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 27 Jul 2016 16:23:35 +0900 Subject: [PATCH] All fields are always returned --- atom/common/api/atom_api_shell.cc | 37 ++++++++----------------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/atom/common/api/atom_api_shell.cc b/atom/common/api/atom_api_shell.cc index fe1e5da1bfdf..be407b72a083 100644 --- a/atom/common/api/atom_api_shell.cc +++ b/atom/common/api/atom_api_shell.cc @@ -98,37 +98,18 @@ mate::Dictionary ReadShortcutLink(v8::Isolate* isolate, using base::win::ShortcutProperties; mate::Dictionary options = mate::Dictionary::CreateEmpty(isolate); 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; - if (base::win::ResolveShortcutProperties( - path, ShortcutProperties::PROPERTIES_TARGET, &properties)) { - options.Set("target", properties.target); - } else { - // No need to continue if it doesn't even have a target. + if (!base::win::ResolveShortcutProperties( + path, ShortcutProperties::PROPERTIES_ALL, &properties)) { return options; } - if (base::win::ResolveShortcutProperties( - path, ShortcutProperties::PROPERTIES_WORKING_DIR, &properties)) { - options.Set("cwd", properties.working_dir); - } - if (base::win::ResolveShortcutProperties( - path, ShortcutProperties::PROPERTIES_ARGUMENTS, &properties)) { - options.Set("args", properties.arguments); - } - 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); - } + options.Set("target", properties.target); + options.Set("cwd", properties.working_dir); + options.Set("args", properties.arguments); + options.Set("description", properties.description); + options.Set("icon", properties.icon); + options.Set("iconIndex", properties.icon_index); + options.Set("appUserModelId", properties.app_id); return options; } #endif