Normalize path
This commit is contained in:
parent
1b4ee6e0d8
commit
5794138ed4
2 changed files with 7 additions and 3 deletions
|
@ -871,6 +871,8 @@ void App::GetFileIcon(const base::FilePath& path,
|
||||||
IconLoader::IconSize icon_size;
|
IconLoader::IconSize icon_size;
|
||||||
FileIconCallback callback;
|
FileIconCallback callback;
|
||||||
|
|
||||||
|
base::FilePath normalized_path = path.NormalizePathSeparators();
|
||||||
|
|
||||||
if (!args->GetNext(&options)) {
|
if (!args->GetNext(&options)) {
|
||||||
icon_size = IconLoader::IconSize::NORMAL;
|
icon_size = IconLoader::IconSize::NORMAL;
|
||||||
} else {
|
} else {
|
||||||
|
@ -885,14 +887,15 @@ void App::GetFileIcon(const base::FilePath& path,
|
||||||
}
|
}
|
||||||
|
|
||||||
IconManager* icon_manager = IconManager::GetInstance();
|
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) {
|
if (icon) {
|
||||||
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
||||||
v8::Locker locker(isolate);
|
v8::Locker locker(isolate);
|
||||||
v8::HandleScope handle_scope(isolate);
|
v8::HandleScope handle_scope(isolate);
|
||||||
callback.Run(v8::Null(isolate), *icon);
|
callback.Run(v8::Null(isolate), *icon);
|
||||||
} else {
|
} else {
|
||||||
icon_manager->LoadIcon(path, icon_size,
|
icon_manager->LoadIcon(normalized_path, icon_size,
|
||||||
base::Bind(&OnIconDataAvailable, callback));
|
base::Bind(&OnIconDataAvailable, callback));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,8 @@ class App : public AtomBrowserClient::Delegate,
|
||||||
public BrowserObserver,
|
public BrowserObserver,
|
||||||
public content::GpuDataManagerObserver {
|
public content::GpuDataManagerObserver {
|
||||||
public:
|
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);
|
static mate::Handle<App> Create(v8::Isolate* isolate);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue