src/mess/tools/imgtool/windows/wimgtool.c
| r1471 | r1472 | |
| 1216 | 1216 | /* figure out the image filename */ |
| 1217 | 1217 | s1 = strrchr(ofn.filename, '\\'); |
| 1218 | 1218 | s1 = s1 ? s1 + 1 : ofn.filename; |
| 1219 | | image_filename = mame_strdup(s1); |
| 1219 | image_filename = (char *) alloca(strlen(s1) + 1); |
| 1220 | strcpy(image_filename, s1); |
| 1220 | 1221 | |
| 1221 | | if (info->current_directory) |
| 1222 | /* append the current directory, if appropriate */ |
| 1223 | if (info->current_directory != NULL) |
| 1222 | 1224 | { |
| 1223 | 1225 | s2 = (char *) alloca(strlen(info->current_directory) + strlen(image_filename) + 1); |
| 1224 | 1226 | strcpy(s2, info->current_directory); |
| 1225 | 1227 | strcat(s2, image_filename); |
| 1226 | | free(image_filename); |
| 1227 | | image_filename = mame_strdup(image_filename); |
| 1228 | image_filename = s2; |
| 1228 | 1229 | } |
| 1229 | 1230 | |
| 1230 | 1231 | err = imgtool_partition_write_file(info->partition, image_filename, fork, stream, opts, filter); |
| r1471 | r1472 | |
| 1236 | 1237 | goto done; |
| 1237 | 1238 | |
| 1238 | 1239 | done: |
| 1239 | | if (image_filename) |
| 1240 | | free(image_filename); |
| 1241 | | if (opts) |
| 1240 | if (opts != NULL) |
| 1242 | 1241 | option_resolution_close(opts); |
| 1243 | 1242 | if (err) |
| 1244 | 1243 | wimgtool_report_error(window, err, image_filename, ofn.filename); |