Previous 15994 Revisions Next

r2892 Wednesday 25th June, 2008 at 11:20:06 UTC by Nathan Woods
Fixed bug #1621
[src/mess]filemngr.c image.c

src/mess/image.c
r2891r2892
17031703{
17041704   image_slot_data *slot = find_image_slot(image);
17051705
1706   char *new_working_directory = mame_strdup(working_directory);
1707   if (slot->working_directory)
1706   char *new_working_directory = (working_directory != NULL) ? mame_strdup(working_directory) : NULL;
1707   if (slot->working_directory != NULL)
17081708      free(slot->working_directory);
17091709   slot->working_directory = new_working_directory;
17101710}
src/mess/filemngr.c
r2891r2892
719719***************************************************************************/
720720
721721/*-------------------------------------------------
722    fix_working_directory - checks the working
723   directory for this device to ensure that it
724   "makes sense"
725-------------------------------------------------*/
726
727static void fix_working_directory(const device_config *device)
728{
729   /* if the image exists, set the working directory to the parent directory */
730   if (image_exists(device))
731   {
732      astring *astr = astring_alloc();
733      zippath_parent(astr, image_filename(selected_device));
734      image_set_working_directory(device, astring_c(astr));
735      astring_free(astr);
736   }
737
738   /* check to see if the path exists; if not clear it */
739   if (check_path(image_working_directory(device)) != FILERR_NONE)
740      image_set_working_directory(device, NULL);
741}
742
743
744
745/*-------------------------------------------------
722746    file_manager_render_extra - perform our
723747    special rendering
724748-------------------------------------------------*/
r2891r2892
814838   {
815839      if (selected_absolute_index >= 0)
816840      {
841         /* ensure that the working directory for this device exists */
842         fix_working_directory(selected_device);
843
817844         /* set up current_directory and current_file - depends on whether we have an image */
818         if (image_exists(selected_device))
819         {
820            /* note that we _should_ be able to use image_working_directory(); please fix */
821            current_directory = zippath_parent(astring_alloc(), image_filename(selected_device));
822            current_file = astring_cpyc(astring_alloc(), image_basename(selected_device));
823         }
824         else
825         {
826            current_directory = astring_cpyc(astring_alloc(), image_working_directory(selected_device));
827            current_file = astring_cpyc(astring_alloc(), "");
828         }
845         current_directory = astring_cpyc(astring_alloc(), image_working_directory(selected_device));
846         current_file = astring_cpyc(astring_alloc(),
847            image_exists(selected_device) ? image_basename(selected_device) : "");
829848
830849         memset(&fs_state, 0, sizeof(fs_state));
831850         return ui_menu_stack_push(menu_file_selector, fs_state.i);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team