Normalize path

This commit is contained in:
Yury Solovyov 2016-11-05 21:55:23 +03:00 committed by Kevin Sawicki
parent 1b4ee6e0d8
commit 5794138ed4
2 changed files with 7 additions and 3 deletions

View file

@ -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));
}
}

View file

@ -45,7 +45,8 @@ class App : public AtomBrowserClient::Delegate,
public BrowserObserver,
public content::GpuDataManagerObserver {
public:
using FileIconCallback = base::Callback<void(v8::Local<v8::Value>, const gfx::Image&)>;
using FileIconCallback = base::Callback<void(v8::Local<v8::Value>,
const gfx::Image&)>;
static mate::Handle<App> Create(v8::Isolate* isolate);