bool DOS_RemoveDir(char const * const dir) { /* We need to do the test before the removal as can not rely on * the host to forbid removal of the current directory. * We never change directory. Everything happens in the drives. */ Bit8u drive;char fulldir[DOS_PATHLENGTH]; if (!DOS_MakeName(dir,fulldir,&drive)) return false; /* Check if exists */ if(!Drives[drive]->TestDir(fulldir)) { DOS_SetError(DOSERR_PATH_NOT_FOUND); return false; } /* See if it's current directory */ char currdir[DOS_PATHLENGTH]= { 0 }; DOS_GetCurrentDir(drive + 1 ,currdir); if(strcmp(currdir,fulldir) == 0) { DOS_SetError(DOSERR_REMOVE_CURRENT_DIRECTORY); return false; } if(Drives[drive]->RemoveDir(fulldir)) return true; /* Failed. We know it exists and it's not the current dir */ /* Assume non empty */ DOS_SetError(DOSERR_ACCESS_DENIED); return false; }
void DOS_Shell::ShowPrompt(void) { Bit8u drive=DOS_GetDefaultDrive()+'A'; char dir[DOS_PATHLENGTH]; dir[0] = 0; //DOS_GetCurrentDir doesn't always return something. (if drive is messed up) DOS_GetCurrentDir(0,dir); WriteOut("%c:\\%s>",drive,dir); }