summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2018-01-29 14:51:07 +0100
committerJean-Philippe Andre <jp.andre@samsung.com>2018-01-30 16:52:24 +0900
commit9f59009131c04b8d95934e15e8b00e6f650d2ec6 (patch)
tree74352e40b275b57aeda48b5dd3d1d5a465acf0f5
parent1770059b8ad4d3584e1c4661e5c562f33dacfffc (diff)
downloadefl-9f59009131c04b8d95934e15e8b00e6f650d2ec6.tar.gz
Eina test: delete tempory file on Windows in eina_test_file_mktemp
-rw-r--r--src/tests/eina/eina_test_file.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/tests/eina/eina_test_file.c b/src/tests/eina/eina_test_file.c
index 07b42daf2e..d4613ebd35 100644
--- a/src/tests/eina/eina_test_file.c
+++ b/src/tests/eina/eina_test_file.c
@@ -27,6 +27,10 @@
#include <unistd.h>
#include <fcntl.h>
+#ifdef _WIN32
+# include <windows.h>
+#endif
+
#include <Eina.h>
#include "eina_safety_checks.h"
#include "eina_file_common.h"
@@ -779,7 +783,18 @@ START_TEST(eina_test_file_mktemp)
if (readlink(fmt, buf, sizeof(buf)))
unlink(buf);
#else
- // TODO: need to implement windows support with GetFinalPathNameByHandle
+ {
+ char buf[4096];
+ HANDLE h;
+ DWORD l;
+
+ h = (HANDLE)_get_osfhandle(fd);
+ fail_if(h == INVALID_HANDLE_VALUE);
+ l = GetFinalPathNameByHandle(h, buf, sizeof(buf), 0);
+ fail_if(l == 0);
+ /* GetFinalPathNameByHandle() preprends path with \\?\ */
+ unlink(buf + 4)
+ }
#endif
close(fd);