1
0
Fork 0

Fix some label issues with cdrom isos. Added some default labels on most stuff.

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2273
This commit is contained in:
Peter Veenstra 2005-08-11 18:57:48 +00:00
parent 31c4fe4ad9
commit 8f74367940
3 changed files with 34 additions and 15 deletions

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dos_programs.cpp,v 1.39 2005-08-08 13:33:45 c2woody Exp $ */
/* $Id: dos_programs.cpp,v 1.40 2005-08-11 18:57:48 qbix79 Exp $ */
#include <stdlib.h>
#include <string.h>
@ -191,6 +191,16 @@ public:
WriteOut(MSG_Get("PROGRAM_MOUNT_STATUS_2"),drive,newdrive->GetInfo());
/* 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(),false);
/* For hard drives set the label to DRIVELETTER_Drive.
* For floppy drives set the label to DRIVELETTER_Floppy.
* This way every drive except cdroms should get a label.*/
else if(type == "dir") {
label = drive; label += "_DRIVE";
newdrive->dirCache.SetLabel(label.c_str(),true);
} else if(type == "floppy") {
label = drive; label += "_FLOPPY";
newdrive->dirCache.SetLabel(label.c_str(),true);
}
return;
showusage:
WriteOut(MSG_Get("PROGRAM_MOUNT_USAGE"));

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: drive_iso.cpp,v 1.8 2005-07-19 19:45:31 qbix79 Exp $ */
/* $Id: drive_iso.cpp,v 1.9 2005-08-11 18:57:48 qbix79 Exp $ */
#include <cctype>
#include <cstring>
@ -265,11 +265,23 @@ bool isoDrive::FindFirst(char *dir, DOS_DTA &dta, bool fcb_findfirst)
Bit8u attr;
char pattern[ISO_MAXPATHNAME];
dta.GetSearchParams(attr, pattern);
if ((attr & DOS_ATTR_VOLUME) && ((*dir == 0) || fcb_findfirst)) {
// Get Volume Label (DOS_ATTR_VOLUME) and only in basedir
dta.SetResult(discLabel, 0, 0, 0, DOS_ATTR_VOLUME);
return true;
if (attr == DOS_ATTR_VOLUME) {
if (strlen(discLabel) != 0) {
dta.SetResult(discLabel, 0, 0, 0, DOS_ATTR_VOLUME);
return true;
} else {
DOS_SetError(DOSERR_NO_MORE_FILES);
return false;
}
} else if ((attr & DOS_ATTR_VOLUME) && (*dir == 0) && !fcb_findfirst) {
if (WildFileCmp(discLabel,pattern)) {
// Get Volume Label (DOS_ATTR_VOLUME) and only in basedir and if it matches the searchstring
dta.SetResult(discLabel, 0, 0, 0, DOS_ATTR_VOLUME);
return true;
}
}
return FindNext(dta);
}

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: drive_local.cpp,v 1.59 2005-07-15 15:23:22 qbix79 Exp $ */
/* $Id: drive_local.cpp,v 1.60 2005-08-11 18:57:48 qbix79 Exp $ */
#include <stdio.h>
#include <stdlib.h>
@ -175,20 +175,17 @@ bool localDrive::FindFirst(char * _dir,DOS_DTA & dta,bool fcb_findfirst) {
if (sAttr == DOS_ATTR_VOLUME) {
if ( strcmp(dirCache.GetLabel(), "") == 0 ) {
LOG(LOG_DOSMISC,LOG_ERROR)("DRIVELABEL REQUESTED: none present, returned NOLABEL");
dta.SetResult("NO_LABEL",0,0,0,DOS_ATTR_VOLUME);
return true;
// LOG(LOG_DOSMISC,LOG_ERROR)("DRIVELABEL REQUESTED: none present, returned NOLABEL");
// dta.SetResult("NO_LABEL",0,0,0,DOS_ATTR_VOLUME);
// return true;
DOS_SetError(DOSERR_NO_MORE_FILES);
return false;
}
dta.SetResult(dirCache.GetLabel(),0,0,0,DOS_ATTR_VOLUME);
return true;
} else if ((sAttr & DOS_ATTR_VOLUME) && (*_dir == 0) && !fcb_findfirst) {
//should check for a valid leading directory instead of 0
//exists==true if the volume label matches the searchmask and the path is valid
if ( strcmp(dirCache.GetLabel(), "") == 0 ) {
LOG(LOG_DOSMISC,LOG_ERROR)("DRIVELABEL REQUESTED: none present, returned NOLABEL");
dta.SetResult("NO_LABEL",0,0,0,DOS_ATTR_VOLUME);
return true;
}
if (WildFileCmp(dirCache.GetLabel(),tempDir)) {
dta.SetResult(dirCache.GetLabel(),0,0,0,DOS_ATTR_VOLUME);
return true;