diff --git a/include/dos_system.h b/include/dos_system.h index 66d28cde..6ccdaef5 100644 --- a/include/dos_system.h +++ b/include/dos_system.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_system.h,v 1.27 2004-11-03 23:13:53 qbix79 Exp $ */ +/* $Id: dos_system.h,v 1.28 2004-11-13 12:08:42 qbix79 Exp $ */ #ifndef DOSSYSTEM_H_ #define DOSSYSTEM_H_ @@ -127,7 +127,7 @@ public: void DeleteEntry (const char* path, bool ignoreLastDir = false); void EmptyCache (void); - void SetLabel (const char* name); + void SetLabel (const char* name,bool allowupdate=true); char* GetLabel (void) { return label; }; class CFileInfo { @@ -185,6 +185,7 @@ private: Bitu nextFreeFindFirst; char label [CROSS_LEN]; + bool updatelabel; }; class DOS_No_Drive_Cache { diff --git a/src/dos/dos_programs.cpp b/src/dos/dos_programs.cpp index 287fe58c..3148d581 100644 --- a/src/dos/dos_programs.cpp +++ b/src/dos/dos_programs.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_programs.cpp,v 1.32 2004-10-26 18:18:22 qbix79 Exp $ */ +/* $Id: dos_programs.cpp,v 1.33 2004-11-13 12:08:43 qbix79 Exp $ */ #include #include @@ -130,7 +130,7 @@ public: } number[index]=0;sizes[count++]=atoi(number); - // get the drive letter + // get the drive letter cmd->FindCommand(1,temp_line); if ((temp_line.size() > 2) || ((temp_line.size()>1) && (temp_line[1]!=':'))) goto showusage; drive=toupper(temp_line[0]); @@ -138,6 +138,10 @@ public: if (!cmd->FindCommand(2,temp_line)) goto showusage; if (!temp_line.size()) goto showusage; +#if defined (WIN32) + /* Removing trailing backslash if not root dir so stat will succeed */ + if(temp_line.size() > 3 && temp_line[temp_line.size()-1]=='\\') temp_line.erase(temp_line.size()-1,1); +#endif struct stat test; if (stat(temp_line.c_str(),&test)) { WriteOut(MSG_Get("PROGRAM_MOUNT_ERROR_1"),temp_line.c_str()); @@ -185,8 +189,8 @@ public: /* Set the correct media byte in the table */ mem_writeb(Real2Phys(dos.tables.mediaid)+drive-'A',newdrive->GetMediaByte()); WriteOut(MSG_Get("PROGRAM_MOUNT_STATUS_2"),drive,newdrive->GetInfo()); - /* check if volume label is given */ - if (cmd->FindString("-label",label,true)) newdrive->dirCache.SetLabel(label.c_str()); + /* 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); return; showusage: WriteOut(MSG_Get("PROGRAM_MOUNT_USAGE")); diff --git a/src/dos/drive_cache.cpp b/src/dos/drive_cache.cpp index 92afa5ca..35893b90 100644 --- a/src/dos/drive_cache.cpp +++ b/src/dos/drive_cache.cpp @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: drive_cache.cpp,v 1.39 2004-10-05 19:50:03 qbix79 Exp $ */ +/* $Id: drive_cache.cpp,v 1.40 2004-11-13 12:08:43 qbix79 Exp $ */ #include "drives.h" #include "dos_inc.h" @@ -69,6 +69,7 @@ DOS_Drive_Cache::DOS_Drive_Cache(void) nextFreeFindFirst = 0; for (Bit32u i=0; iupdatelabel) return; + this->updatelabel = allowupdate; Bitu togo = 8; Bitu vnamePos = 0; Bitu labelPos = 0; @@ -128,7 +136,7 @@ void DOS_Drive_Cache::SetLabel(const char* vname) //Remove trailing dot. if((labelPos > 0) && (label[labelPos-1] == '.')) label[labelPos-1]=0; -// LOG(LOG_ALL,LOG_ERROR)("CACHE: Set volume label to %s",label); + LOG(LOG_DOSMISC,LOG_NORMAL)("DIRCACHE: Set volume label to %s",label); }; Bit16u DOS_Drive_Cache::GetFreeID(CFileInfo* dir) @@ -151,13 +159,9 @@ void DOS_Drive_Cache::SetBaseDir(const char* baseDir) char labellocal[256]={ 0 }; char drive[4] = "C:\\"; drive[0] = basePath[0]; - UINT type_drive=GetDriveType(drive); - if(type_drive != DRIVE_FIXED) { - //Only add label for non-fixed drives. (so stuff like "mount c c:\piet -t cdrom -label piet" works) - if (GetVolumeInformation(drive,labellocal,256,NULL,NULL,NULL,NULL,0)) { - LOG(LOG_MISC,LOG_NORMAL)("Cache: setting label for (non-fixed localdrive) to %s",labellocal); - SetLabel(labellocal); - } + if (GetVolumeInformation(drive,labellocal,256,NULL,NULL,NULL,NULL,0)) { + /* Set label and allow being updated */ + SetLabel(labellocal,true); } #endif };