🔧 Ensure correct path
This commit is contained in:
parent
2abde14a7c
commit
741dc1eb0b
1 changed files with 10 additions and 1 deletions
|
@ -12,6 +12,7 @@
|
||||||
#include "base/files/file_util.h"
|
#include "base/files/file_util.h"
|
||||||
#include "base/md5.h"
|
#include "base/md5.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
|
#include "base/time/time.h"
|
||||||
#include "base/win/windows_version.h"
|
#include "base/win/windows_version.h"
|
||||||
#include "brightray/browser/win/notification_presenter_win7.h"
|
#include "brightray/browser/win/notification_presenter_win7.h"
|
||||||
#include "brightray/browser/win/windows_toast_notification.h"
|
#include "brightray/browser/win/windows_toast_notification.h"
|
||||||
|
@ -64,7 +65,15 @@ bool NotificationPresenterWin::Init() {
|
||||||
|
|
||||||
base::string16 NotificationPresenterWin::SaveIconToFilesystem(
|
base::string16 NotificationPresenterWin::SaveIconToFilesystem(
|
||||||
const SkBitmap& icon, const GURL& origin) {
|
const SkBitmap& icon, const GURL& origin) {
|
||||||
std::string filename = base::MD5String(origin.spec()) + ".png";
|
std::string filename;
|
||||||
|
|
||||||
|
if (origin.is_valid()) {
|
||||||
|
filename = base::MD5String(origin.spec()) + ".png";
|
||||||
|
} else {
|
||||||
|
base::TimeTicks now = base::TimeTicks::Now();
|
||||||
|
filename = std::to_string(now.ToInternalValue()) + ".png";
|
||||||
|
}
|
||||||
|
|
||||||
base::FilePath path = temp_dir_.GetPath().Append(base::UTF8ToUTF16(filename));
|
base::FilePath path = temp_dir_.GetPath().Append(base::UTF8ToUTF16(filename));
|
||||||
if (base::PathExists(path))
|
if (base::PathExists(path))
|
||||||
return path.value();
|
return path.value();
|
||||||
|
|
Loading…
Reference in a new issue