win: Delete temp file on reboot, fix #1084
This commit is contained in:
parent
27011ad0c8
commit
11cb777e35
1 changed files with 6 additions and 5 deletions
|
@ -16,12 +16,13 @@ ScopedTemporaryFile::ScopedTemporaryFile() {
|
||||||
|
|
||||||
ScopedTemporaryFile::~ScopedTemporaryFile() {
|
ScopedTemporaryFile::~ScopedTemporaryFile() {
|
||||||
if (!path_.empty()) {
|
if (!path_.empty()) {
|
||||||
// On Windows calling base::DeleteFile on exit will call an API that would
|
|
||||||
// halt the program, so we have to call the win32 API directly.
|
|
||||||
#if defined(OS_WIN)
|
|
||||||
::DeleteFile(path_.value().c_str());
|
|
||||||
#else
|
|
||||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||||
|
// On Windows it is very likely the file is already in use (because it is
|
||||||
|
// mostly used for Node native modules), so deleting it now will halt the
|
||||||
|
// program.
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
base::DeleteFileAfterReboot(path_);
|
||||||
|
#else
|
||||||
base::DeleteFile(path_, false);
|
base::DeleteFile(path_, false);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue