Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/cxong/tinydir.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCong <congusbongus@gmail.com>2016-07-19 05:05:46 +0300
committerGitHub <noreply@github.com>2016-07-19 05:05:46 +0300
commit1f9b31e190bff77efd323de33879d941c96e1908 (patch)
tree1789a753f9fdeaf845f9ef943a08daea6c806bba
parent497788421f4c9a2fa2e7fa4cc37ca3f8859bb4e3 (diff)
parentd1575e1285224a575e5a2ba345bcfc85c3344cf8 (diff)
Merge pull request #37 from lautis0503/master
Fix unicode support in tinydir_file_open
-rw-r--r--tinydir.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/tinydir.h b/tinydir.h
index 0a9da0c..0a17736 100644
--- a/tinydir.h
+++ b/tinydir.h
@@ -33,11 +33,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
extern "C" {
#endif
-#if ((defined _UNICODE) & !(defined UNICODE))
+#if ((defined _UNICODE) && !(defined UNICODE))
#define UNICODE
#endif
-#if ((defined UNICODE) & !(defined _UNICODE))
+#if ((defined UNICODE) && !(defined _UNICODE))
#define _UNICODE
#endif
@@ -643,9 +643,13 @@ int tinydir_file_open(tinydir_file *file, const _tinydir_char_t *path)
}
/* Emulate the behavior of dirname by returning "." for dir name if it's
empty */
+#if ((defined _MSC_VER || defined __MINGW32__) && (defined UNICODE))
+ if (drive_buf[0] == '\0' && drive_buf[1] == '\0' && dir_name_buf[0] == '\0' && dir_name_buf[1] == '\0')
+#else
if (drive_buf[0] == '\0' && dir_name_buf[0] == '\0')
+#endif
{
- strcpy(dir_name_buf, ".");
+ _tinydir_strcpy(dir_name_buf, TINYDIR_STRING("."));
}
/* Concatenate the drive letter and dir name to form full dir name */
_tinydir_strcat(drive_buf, dir_name_buf);