Skip to content

Commit 11cb777

Browse files
committed
win: Delete temp file on reboot, fix electron#1084
1 parent 27011ad commit 11cb777

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

atom/common/asar/scoped_temporary_file.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ ScopedTemporaryFile::ScopedTemporaryFile() {
1616

1717
ScopedTemporaryFile::~ScopedTemporaryFile() {
1818
if (!path_.empty()) {
19-
// On Windows calling base::DeleteFile on exit will call an API that would
20-
// halt the program, so we have to call the win32 API directly.
19+
base::ThreadRestrictions::ScopedAllowIO allow_io;
20+
// On Windows it is very likely the file is already in use (because it is
21+
// mostly used for Node native modules), so deleting it now will halt the
22+
// program.
2123
#if defined(OS_WIN)
22-
::DeleteFile(path_.value().c_str());
24+
base::DeleteFileAfterReboot(path_);
2325
#else
24-
base::ThreadRestrictions::ScopedAllowIO allow_io;
2526
base::DeleteFile(path_, false);
2627
#endif
2728
}

0 commit comments

Comments
 (0)