diff --git a/src/dos/dos_programs.cpp b/src/dos/dos_programs.cpp index 66bebbdd..0bd0a2a8 100644 --- a/src/dos/dos_programs.cpp +++ b/src/dos/dos_programs.cpp @@ -272,7 +272,7 @@ public: if (type == "overlay") { //Ensure that the base drive exists: if (!Drives[drive-'A']) { - WriteOut("No basedrive mounted yet!"); + WriteOut(MSG_Get("PROGRAM_MOUNT_OVERLAY_NO_BASE")); return; } } else if (Drives[drive-'A']) { @@ -362,7 +362,7 @@ public: localDrive* ldp = dynamic_cast(Drives[drive - 'A']); cdromDrive* cdp = dynamic_cast(Drives[drive - 'A']); if (!ldp || cdp) { - WriteOut("Basedrive not compatible"); + WriteOut(MSG_Get("PROGRAM_MOUNT_OVERLAY_INCOMPAT_BASE")); return; } std::string base = ldp->getBasedir(); @@ -371,20 +371,26 @@ public: //Erase old drive on success if (newdrive) { if (o_error) { - if (o_error == 1) WriteOut("No mixing of relative and absolute paths. Overlay failed."); - else if (o_error == 2) WriteOut("overlay directory can not be the same as underlying file system."); - else WriteOut("Something went wrong"); + if (o_error == 1) WriteOut(MSG_Get("PROGRAM_MOUNT_OVERLAY_MIXED_BASE")); + else if (o_error == 2) WriteOut(MSG_Get("PROGRAM_MOUNT_OVERLAY_SAME_AS_BASE")); + else WriteOut(MSG_Get("PROGRAM_MOUNT_OVERLAY_GENERIC_ERROR")); delete newdrive; return; } + + //Copy current directory if not marked as deleted. + if (newdrive->TestDir(ldp->curdir)) { + strcpy(newdrive->curdir,ldp->curdir); + } + delete Drives[drive - 'A']; Drives[drive - 'A'] = 0; } else { - WriteOut("overlaydrive construction failed."); + WriteOut(MSG_Get("PROGRAM_MOUNT_OVERLAY_GENERIC_ERROR")); return; } } else { - newdrive=new localDrive(temp_line.c_str(),sizes[0],bit8size,sizes[2],sizes[3],mediaid); + newdrive = new localDrive(temp_line.c_str(),sizes[0],bit8size,sizes[2],sizes[3],mediaid); } } } else { @@ -396,7 +402,7 @@ public: /* Set the correct media byte in the table */ mem_writeb(Real2Phys(dos.tables.mediaid) + (drive - 'A') * 9, newdrive->GetMediaByte()); if (type != "overlay") WriteOut(MSG_Get("PROGRAM_MOUNT_STATUS_2"),drive,newdrive->GetInfo()); - else WriteOut("Overlay %s on drive %c mounted.\n",temp_line.c_str(),drive); + else WriteOut(MSG_Get("PROGRAM_MOUNT_OVERLAY_STATUS"),temp_line.c_str(),drive); /* check if volume label is given and don't allow it to updated in the future */ if (cmd->FindString("-label",label,true)) newdrive->dirCache.SetLabel(label.c_str(),iscdrom,false); /* For hard drives set the label to DRIVELETTER_Drive. @@ -1562,6 +1568,12 @@ void DOS_SetupPrograms(void) { MSG_Add("PROGRAM_MOUNT_WARNING_WIN","\033[31;1mMounting c:\\ is NOT recommended. Please mount a (sub)directory next time.\033[0m\n"); MSG_Add("PROGRAM_MOUNT_WARNING_OTHER","\033[31;1mMounting / is NOT recommended. Please mount a (sub)directory next time.\033[0m\n"); MSG_Add("PROGRAM_MOUNT_NO_OPTION", "Warning: Ignoring unsupported option '%s'.\n"); + MSG_Add("PROGRAM_MOUNT_OVERLAY_NO_BASE","A normal directory needs to be MOUNTed first before an overlay can be added on top.\n"); + MSG_Add("PROGRAM_MOUNT_OVERLAY_INCOMPAT_BASE","The overlay is NOT compatible with the drive that is specified.\n"); + MSG_Add("PROGRAM_MOUNT_OVERLAY_MIXED_BASE","The overlay needs to be specified using the same addressing as the underlying drive. No mixing of relative and absolute paths."); + MSG_Add("PROGRAM_MOUNT_OVERLAY_SAME_AS_BASE","The overlay directory can not be the same as underlying drive.\n"); + MSG_Add("PROGRAM_MOUNT_OVERLAY_GENERIC_ERROR","Something went wrong.\n"); + MSG_Add("PROGRAM_MOUNT_OVERLAY_STATUS","Overlay %s on drive %c mounted.\n"); MSG_Add("PROGRAM_MEM_CONVEN","%10d Kb free conventional memory\n"); MSG_Add("PROGRAM_MEM_EXTEND","%10d Kb free extended memory\n");