diff options
author | Ivan Furs <i.furs@samsung.com> | 2017-03-15 10:49:19 -0700 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2017-03-15 10:49:55 -0700 |
commit | 4d13273e3b3090579e11438fd32cbbe1d64db4b4 (patch) | |
tree | 5eec9e36726e372fc63bc8b93dceb1781c9a0991 | |
parent | 24ed55539d76d546a0fb29379acfe241c633ddd8 (diff) | |
download | efl-4d13273e3b3090579e11438fd32cbbe1d64db4b4.tar.gz |
eina_file: fixed T2244
Summary:
dirty fix for 'eet' problems with file deletion on WINDOWS
to work with the commit: D4698, D4699
Reviewers: cedric, NikaWhite, rimmed, vtorri, raster
Reviewed By: cedric
Subscribers: artem.popov, cedric, jpeg
Maniphest Tasks: T2244
Differential Revision: https://phab.enlightenment.org/D4701
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r-- | src/lib/eina/eina_file_win32.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/lib/eina/eina_file_win32.c b/src/lib/eina/eina_file_win32.c index 9d6bf1b444..96d252909d 100644 --- a/src/lib/eina/eina_file_win32.c +++ b/src/lib/eina/eina_file_win32.c @@ -383,7 +383,7 @@ eina_file_real_close(Eina_File *file) free(map); } - if (file->global_map != MAP_FAILED && file->handle != NULL) + if (file->global_map != MAP_FAILED) UnmapViewOfFile(file->global_map); if (file->handle != INVALID_HANDLE_VALUE) @@ -730,7 +730,7 @@ eina_file_open(const char *path, Eina_Bool shared) else #endif handle = CreateFile(filename, - GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, + GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); @@ -832,7 +832,21 @@ eina_file_unlink(const char *pathname) if (file->handle != INVALID_HANDLE_VALUE) { CloseHandle(file->handle); - file->handle = INVALID_HANDLE_VALUE; + + file->handle = CreateFile(unlink_path, + GENERIC_READ, + FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, + NULL); + + if (file->handle != INVALID_HANDLE_VALUE) + { + CloseHandle(file->handle); + file->handle = INVALID_HANDLE_VALUE; + return EINA_TRUE; + } } } |