summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine ELIAS <antoine.elias@scilab-enterprises.com>2016-11-10 08:35:49 +0100
committerAntoine ELIAS <antoine.elias@scilab-enterprises.com>2016-11-10 08:35:49 +0100
commitc234522260f8b41b5d862194ba49380fe4db61e7 (patch)
tree1a4f7b609dd0d50a7c655a373f1acf33b270d1b3
parent3cffa8f9956266849b0f14cb416960075b9c5274 (diff)
downloadscilab-c234522260f8b41b5d862194ba49380fe4db61e7.zip
scilab-c234522260f8b41b5d862194ba49380fe4db61e7.tar.gz
utf: commons 2
Change-Id: I2258a0b2d676a1c679419a472b59b9fa60032995
-rw-r--r--scilab/modules/commons/src/c/fileutils.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/scilab/modules/commons/src/c/fileutils.c b/scilab/modules/commons/src/c/fileutils.c
index 0388f4a..316a3cf 100644
--- a/scilab/modules/commons/src/c/fileutils.c
+++ b/scilab/modules/commons/src/c/fileutils.c
@@ -34,17 +34,15 @@
34#ifdef _MSC_VER 34#ifdef _MSC_VER
35int isEmptyDirectory(char *dirName) 35int isEmptyDirectory(char *dirName)
36{ 36{
37 wchar_t *wcpath = NULL; 37 char *path = NULL;
38 wchar_t wdirpath[PATH_MAX + FILENAME_MAX + 1]; 38 char dirpath[PATH_MAX + FILENAME_MAX + 1];
39 HANDLE hFile; 39 HANDLE hFile;
40 WIN32_FIND_DATAW FileInformation; 40 WIN32_FIND_DATAA FileInformation;
41 int ret = 1; 41 int ret = 1;
42 42
43 wcpath = to_wide_string(dirName); 43 os_sprintf(dirpath, PATH_MAX + FILENAME_MAX + 1, "%s\\*", dirName);
44 os_swprintf(wdirpath, wcslen(wcpath) + 2 + 1, L"%s\\*", wcpath);
45 FREE(wcpath);
46 44
47 hFile = FindFirstFileW(wdirpath, &FileInformation); 45 hFile = FindFirstFile(dirpath, &FileInformation);
48 46
49 if (hFile == INVALID_HANDLE_VALUE) 47 if (hFile == INVALID_HANDLE_VALUE)
50 { 48 {
@@ -53,7 +51,7 @@ int isEmptyDirectory(char *dirName)
53 51
54 do 52 do
55 { 53 {
56 if (!wcscmp(FileInformation.cFileName, L".") || !wcscmp(FileInformation.cFileName, L"..")) 54 if (!strcmp(FileInformation.cFileName, ".") || !strcmp(FileInformation.cFileName, ".."))
57 { 55 {
58 continue; 56 continue;
59 } 57 }
@@ -61,7 +59,7 @@ int isEmptyDirectory(char *dirName)
61 ret = 0; 59 ret = 0;
62 break; 60 break;
63 } 61 }
64 while (FindNextFileW(hFile, &FileInformation) == TRUE); 62 while (FindNextFile(hFile, &FileInformation) == TRUE);
65 63
66 FindClose(hFile); 64 FindClose(hFile);
67 65