Nearly complete USB memory support

This commit is contained in:
QCDLZCLW3K
2022-05-30 02:00:49 +00:00
parent 4be866e69e
commit 852d770629
10 changed files with 296 additions and 39 deletions
+8 -6
View File
@@ -172,18 +172,20 @@ FILE *fopen_appdata(const char *vendor, const char *filename, const char *mode)
bool path_mkdir(const char *path)
{
bool success;
char buf[MAX_PATH];
char *pos;
str_cpy(buf, lengthof(buf), path);
for (pos = path_next_element(buf); pos; pos = path_next_element(pos + 1)) {
char c = *pos;
*pos = '\0';
if (strlen(buf) != 2 || buf[1] != ':') {
CreateDirectory(buf, NULL);
if (strlen(buf) != 2 || (strlen(buf) >= 2 && buf[1] != ':')) {
success = CreateDirectory(buf, NULL);
if (GetLastError() != ERROR_ALREADY_EXISTS) {
if (!success && GetLastError() != ERROR_ALREADY_EXISTS) {
log_warning(
"%s: Cannot create directory: %#x",
buf,
@@ -193,12 +195,12 @@ bool path_mkdir(const char *path)
}
}
*pos = '/';
*pos = c;
}
CreateDirectory(buf, NULL);
success = CreateDirectory(buf, NULL);
if (GetLastError() != ERROR_ALREADY_EXISTS) {
if (!success && GetLastError() != ERROR_ALREADY_EXISTS) {
log_warning(
"%s: Cannot create directory: %#x",
buf,