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-17 06:05:03 +0300
committerCong <congusbongus@gmail.com>2016-07-17 06:05:03 +0300
commite33a1dadc7d8f2cc80e50e992b2a596cde1f00e1 (patch)
treeacf87f08269b01fda60355dc3f76f69ef0ffa6c3 /tinydir.h
parentfe199959435f04931789ae98cad53a64148c856c (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.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/tinydir.h b/tinydir.h
index 8a76050..0a9da0c 100644
--- a/tinydir.h
+++ b/tinydir.h
@@ -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;