diff options
author | Cong <congusbongus@gmail.com> | 2016-07-17 06:05:03 +0300 |
---|---|---|
committer | Cong <congusbongus@gmail.com> | 2016-07-17 06:05:03 +0300 |
commit | e33a1dadc7d8f2cc80e50e992b2a596cde1f00e1 (patch) | |
tree | acf87f08269b01fda60355dc3f76f69ef0ffa6c3 /tinydir.h | |
parent | fe199959435f04931789ae98cad53a64148c856c (diff) |
Fix tinydir_file_open with filename only failure in Windows (fixes #35)
Implement file_open_test for Windows
Diffstat (limited to 'tinydir.h')
-rw-r--r-- | tinydir.h | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -641,6 +641,12 @@ int tinydir_file_open(tinydir_file *file, const _tinydir_char_t *path) errno = EINVAL; return -1; } + /* Emulate the behavior of dirname by returning "." for dir name if it's + empty */ + if (drive_buf[0] == '\0' && dir_name_buf[0] == '\0') + { + strcpy(dir_name_buf, "."); + } /* Concatenate the drive letter and dir name to form full dir name */ _tinydir_strcat(drive_buf, dir_name_buf); dir_name = drive_buf; |