From ff5b8047a1fe3bff25a08fb869d0174ed218a89f Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 27 Jul 2016 16:32:32 +0900 Subject: [PATCH] Throw exception when ReadShortcutLink failed --- atom/common/api/atom_api_shell.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/atom/common/api/atom_api_shell.cc b/atom/common/api/atom_api_shell.cc index be407b72a083..d8113daf56e0 100644 --- a/atom/common/api/atom_api_shell.cc +++ b/atom/common/api/atom_api_shell.cc @@ -93,15 +93,16 @@ bool WriteShortcutLink(const base::FilePath& shortcut_path, shortcut_path, properties, operation); } -mate::Dictionary ReadShortcutLink(v8::Isolate* isolate, - const base::FilePath& path) { +v8::Local ReadShortcutLink(mate::Arguments* args, + const base::FilePath& path) { using base::win::ShortcutProperties; - mate::Dictionary options = mate::Dictionary::CreateEmpty(isolate); + mate::Dictionary options = mate::Dictionary::CreateEmpty(args->isolate()); base::win::ScopedCOMInitializer com_initializer; base::win::ShortcutProperties properties; if (!base::win::ResolveShortcutProperties( path, ShortcutProperties::PROPERTIES_ALL, &properties)) { - return options; + args->ThrowError("Failed to read shortcut link"); + return v8::Null(args->isolate()); } options.Set("target", properties.target); options.Set("cwd", properties.working_dir); @@ -110,7 +111,7 @@ mate::Dictionary ReadShortcutLink(v8::Isolate* isolate, options.Set("icon", properties.icon); options.Set("iconIndex", properties.icon_index); options.Set("appUserModelId", properties.app_id); - return options; + return options.GetHandle(); } #endif