Mercurial > repos > blastem
comparison util.c @ 1540:e94cff9cb625 nuklear_ui
Make sure config directory exists before trying to save config file
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 25 Mar 2018 12:00:29 -0700 |
parents | 4f6e8acd7b6a |
children | 5efeca06d942 |
comparison
equal
deleted
inserted
replaced
1539:5b1157eb189d | 1540:e94cff9cb625 |
---|---|
547 //adjust for difference between Windows and Unix Epoch | 547 //adjust for difference between Windows and Unix Epoch |
548 wintime -= 11644473600LL; | 548 wintime -= 11644473600LL; |
549 return (time_t)wintime; | 549 return (time_t)wintime; |
550 } | 550 } |
551 | 551 |
552 int ensure_dir_exists(char *path) | 552 int ensure_dir_exists(const char *path) |
553 { | 553 { |
554 if (CreateDirectory(path, NULL)) { | 554 if (CreateDirectory(path, NULL)) { |
555 return 1; | 555 return 1; |
556 } | 556 } |
557 if (GetLastError() == ERROR_ALREADY_EXISTS) { | 557 if (GetLastError() == ERROR_ALREADY_EXISTS) { |
701 //Android's Bionic doesn't support the new style so we'll use the old one instead | 701 //Android's Bionic doesn't support the new style so we'll use the old one instead |
702 return st.st_mtime; | 702 return st.st_mtime; |
703 #endif | 703 #endif |
704 } | 704 } |
705 | 705 |
706 int ensure_dir_exists(char *path) | 706 int ensure_dir_exists(const char *path) |
707 { | 707 { |
708 struct stat st; | 708 struct stat st; |
709 if (stat(path, &st)) { | 709 if (stat(path, &st)) { |
710 if (errno == ENOENT) { | 710 if (errno == ENOENT) { |
711 char *parent = strdup(path); | 711 char *parent = strdup(path); |