Permalink
Browse files

MOUNT option for local folders, to disable caching (if you would rath…

…er not run RESCAN every time the host filesystem changes behind DOSBox-X)
  • Loading branch information...
joncampbell123 committed Feb 8, 2018
1 parent 0d1beeb commit cf142387b7108d61666c99f9b8bd7bee5f054284
Showing with 25 additions and 0 deletions.
  1. +1 −0 include/dos_system.h
  2. +5 −0 src/dos/dos_programs.cpp
  3. +18 −0 src/dos/drive_local.cpp
  4. +1 −0 src/dos/drives.cpp
View
@@ -269,6 +269,7 @@ class DOS_Drive {
char * GetBaseDir(void);
bool readonly;
bool nocachedir;
char curdir[DOS_PATHLENGTH];
char info[256];
/* Can be overridden for example in iso images */
View
@@ -246,6 +246,10 @@ class MOUNT : public Program {
return;
}
bool nocachedir = false;
if (cmd->FindExist("-nocachedir",true))
nocachedir = true;
bool readonly = false;
if (cmd->FindExist("-ro",true))
readonly = true;
@@ -462,6 +466,7 @@ class MOUNT : public Program {
LOG_MSG("ERROR:This build does not support physfs");
} else {
newdrive=new localDrive(temp_line.c_str(),sizes[0],bit8size,sizes[2],sizes[3],mediaid);
newdrive->nocachedir = nocachedir;
newdrive->readonly = readonly;
}
}
View
@@ -347,6 +347,8 @@ char *CodePageHostToGuest(const host_cnv_char_t *s) {
}
bool localDrive::FileCreate(DOS_File * * file,const char * name,Bit16u /*attributes*/) {
if (nocachedir) EmptyCache();
if (readonly) {
DOS_SetError(DOSERR_WRITE_PROTECTED);
return false;
@@ -404,6 +406,8 @@ bool localDrive::FileCreate(DOS_File * * file,const char * name,Bit16u /*attribu
}
bool localDrive::FileOpen(DOS_File * * file,const char * name,Bit32u flags) {
if (nocachedir) EmptyCache();
if (readonly) {
if ((flags&0xf) == OPEN_WRITE || (flags&0xf) == OPEN_READWRITE) {
DOS_SetError(DOSERR_WRITE_PROTECTED);
@@ -597,6 +601,8 @@ bool localDrive::FindFirst(const char * _dir,DOS_DTA & dta,bool fcb_findfirst) {
strcat(tempDir,_dir);
CROSS_FILENAME(tempDir);
if (nocachedir) EmptyCache();
if (allocation.mediaid==0xF0 ) {
EmptyCache(); //rescan floppie-content on each findfirst
}
@@ -716,6 +722,8 @@ bool localDrive::FindNext(DOS_DTA & dta) {
}
bool localDrive::GetFileAttr(const char * name,Bit16u * attr) {
if (nocachedir) EmptyCache();
char newname[CROSS_LEN];
strcpy(newname,basedir);
strcat(newname,name);
@@ -741,6 +749,8 @@ bool localDrive::GetFileAttr(const char * name,Bit16u * attr) {
}
bool localDrive::MakeDir(const char * dir) {
if (nocachedir) EmptyCache();
if (readonly) {
DOS_SetError(DOSERR_WRITE_PROTECTED);
return false;
@@ -772,6 +782,8 @@ bool localDrive::MakeDir(const char * dir) {
}
bool localDrive::RemoveDir(const char * dir) {
if (nocachedir) EmptyCache();
if (readonly) {
DOS_SetError(DOSERR_WRITE_PROTECTED);
return false;
@@ -802,6 +814,8 @@ bool localDrive::RemoveDir(const char * dir) {
}
bool localDrive::TestDir(const char * dir) {
if (nocachedir) EmptyCache();
char newdir[CROSS_LEN];
strcpy(newdir,basedir);
strcat(newdir,dir);
@@ -890,6 +904,8 @@ bool localDrive::AllocationInfo(Bit16u * _bytes_sector,Bit8u * _sectors_cluster,
}
bool localDrive::FileExists(const char* name) {
if (nocachedir) EmptyCache();
char newname[CROSS_LEN];
strcpy(newname,basedir);
strcat(newname,name);
@@ -910,6 +926,8 @@ bool localDrive::FileExists(const char* name) {
}
bool localDrive::FileStat(const char* name, FileStat_Block * const stat_block) {
if (nocachedir) EmptyCache();
char newname[CROSS_LEN];
strcpy(newname,basedir);
strcat(newname,name);
View
@@ -111,6 +111,7 @@ void Set_Label(char const * const input, char * const output, bool cdrom) {
DOS_Drive::DOS_Drive() {
nocachedir=false;
readonly=false;
curdir[0]=0;
info[0]=0;

0 comments on commit cf14238

Please sign in to comment.