src/mess/osd/windows/winmess.c
| r2915 | r2916 | |
| 109 | 109 | if (t_path == NULL) |
| 110 | 110 | goto done; |
| 111 | 111 | |
| 112 | | // attempt to find the first file |
| 113 | | find = FindFirstFile(t_path, &find_data); |
| 114 | | if (find == INVALID_HANDLE_VALUE) |
| 115 | | goto done; |
| 112 | // is this path a root directory (e.g. - C:)? |
| 113 | if (isalpha(path[0]) && (path[1] == ':') && (path[2] == '\0')) |
| 114 | { |
| 115 | // need to do special logic for root directories |
| 116 | memset(&find_data, 0, sizeof(find_data)); |
| 117 | find_data.dwFileAttributes = GetFileAttributes(t_path); |
| 118 | } |
| 119 | else |
| 120 | { |
| 121 | // attempt to find the first file |
| 122 | find = FindFirstFile(t_path, &find_data); |
| 123 | if (find == INVALID_HANDLE_VALUE) |
| 124 | goto done; |
| 125 | } |
| 116 | 126 | |
| 117 | 127 | // create an osd_directory_entry; be sure to make sure that the caller can |
| 118 | 128 | // free all resources by just freeing the resulting osd_directory_entry |
| r2915 | r2916 | |
| 125 | 135 | result->size = find_data.nFileSizeLow | ((UINT64) find_data.nFileSizeHigh << 32); |
| 126 | 136 | |
| 127 | 137 | done: |
| 128 | | if (t_path) |
| 138 | if (t_path != NULL) |
| 129 | 139 | free(t_path); |
| 130 | 140 | return result; |
| 131 | 141 | } |