From 5794138ed43d76f25291428bf25f37dd6b12ed7b Mon Sep 17 00:00:00 2001 From: Yury Solovyov Date: Sat, 5 Nov 2016 21:55:23 +0300 Subject: [PATCH] Normalize path --- atom/browser/api/atom_api_app.cc | 7 +++++-- atom/browser/api/atom_api_app.h | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/atom/browser/api/atom_api_app.cc b/atom/browser/api/atom_api_app.cc index 7358960685d..9beff988059 100644 --- a/atom/browser/api/atom_api_app.cc +++ b/atom/browser/api/atom_api_app.cc @@ -871,6 +871,8 @@ void App::GetFileIcon(const base::FilePath& path, IconLoader::IconSize icon_size; FileIconCallback callback; + base::FilePath normalized_path = path.NormalizePathSeparators(); + if (!args->GetNext(&options)) { icon_size = IconLoader::IconSize::NORMAL; } else { @@ -885,14 +887,15 @@ void App::GetFileIcon(const base::FilePath& path, } IconManager* icon_manager = IconManager::GetInstance(); - gfx::Image* icon = icon_manager->LookupIconFromFilepath(path, icon_size); + gfx::Image* icon = icon_manager->LookupIconFromFilepath(normalized_path, + icon_size); if (icon) { v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Locker locker(isolate); v8::HandleScope handle_scope(isolate); callback.Run(v8::Null(isolate), *icon); } else { - icon_manager->LoadIcon(path, icon_size, + icon_manager->LoadIcon(normalized_path, icon_size, base::Bind(&OnIconDataAvailable, callback)); } } diff --git a/atom/browser/api/atom_api_app.h b/atom/browser/api/atom_api_app.h index b89761ede5d..b051e4e5fa7 100644 --- a/atom/browser/api/atom_api_app.h +++ b/atom/browser/api/atom_api_app.h @@ -45,7 +45,8 @@ class App : public AtomBrowserClient::Delegate, public BrowserObserver, public content::GpuDataManagerObserver { public: - using FileIconCallback = base::Callback, const gfx::Image&)>; + using FileIconCallback = base::Callback, + const gfx::Image&)>; static mate::Handle Create(v8::Isolate* isolate);