1
0
Fork 0

Copy working directory when mounting an overlay. Add some more strings to language file.

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4309
This commit is contained in:
Peter Veenstra 2020-01-21 09:02:06 +00:00
parent 8be4b7a850
commit 88ac8b2dd9

View file

@ -281,7 +281,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']) {
@ -422,7 +422,7 @@ public:
localDrive* ldp = dynamic_cast<localDrive*>(Drives[drive-'A']);
cdromDrive* cdp = dynamic_cast<cdromDrive*>(Drives[drive-'A']);
if (!ldp || cdp) {
WriteOut("Basedrive not compatible");
WriteOut(MSG_Get("PROGRAM_MOUNT_OVERLAY_INCOMPAT_BASE"));
return;
}
std::string base = ldp->getBasedir();
@ -431,20 +431,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 {
@ -456,7 +462,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.
@ -1645,6 +1651,12 @@ void DOS_SetupPrograms(void) {
MSG_Add("PROGRAM_MOUNT_UMOUNT_NO_VIRTUAL","Virtual Drives can not be unMOUNTed.\n");
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_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");