(self, dos_pathmask)
Remove regular files that match given BASIC path and mask.
Remove regular files that match given BASIC path and mask.
Remove regular files that match given BASIC path and mask .
def kill(self, dos_pathmask):
        """Remove regular files that match given BASIC path and mask."""
        native_dir, _, dos_mask = self._split_pathmask(dos_pathmask)
        _, files = self._get_dirs_files(native_dir)
        # filter according to mask
        trunkmask, extmask = dos_splitext(dos_mask)
        dos_to_native = {
            self._get_dos_display_name(native_dir, _native_name): _native_name
            for _native_name in files
        }
        to_kill_dos = []
        for dos_name in dos_to_native:
            trunk, ext = dos_splitext(dos_name)
            if dos_name_matches(trunk, trunkmask) and dos_name_matches(ext, extmask):
                to_kill_dos.append(dos_name)
        to_kill = [
            # NOTE that this depends on display names NOT being legal names for overlong names
            # i.e. a + is included at the end of the display name which is not legal
            os.path.join(native_dir, dos_to_native[_dos_name])
            for _dos_name in to_kill_dos
            if (
                dos_is_legal_name(_dos_name) and
                not is_hidden(os.path.join(native_dir, dos_to_native[_dos_name]))
            )
        ]
        if not to_kill:
            raise error.BASICError(error.FILE_NOT_FOUND)
        for dos_path in to_kill_dos:
            # don't delete open files
            self.require_file_not_open(dos_path)
        for native_path in to_kill:
            safe(os.remove, native_path)
def kill ( self , dos_pathmask ) : native_dir , _ , dos_mask = self . _split_pathmask ( dos_pathmask ) _ , files = self . _get_dirs_files ( native_dir ) # filter according to mask trunkmask , extmask = dos_splitext ( dos_mask ) dos_to_native = { self . _get_dos_display_name ( native_dir , _native_name ) : _native_name for _native_name in files } to_kill_dos = [ ] for dos_name in dos_to_native : trunk , ext = dos_splitext ( dos_name ) if dos_name_matches ( trunk , trunkmask ) and dos_name_matches ( ext , extmask ) : to_kill_dos . append ( dos_name ) to_kill = [ # NOTE that this depends on display names NOT being legal names for overlong names # i.e. a + is included at the end of the display name which is not legal os . path . join ( native_dir , dos_to_native [ _dos_name ] ) for _dos_name in to_kill_dos if ( dos_is_legal_name ( _dos_name ) and not is_hidden ( os . path . join ( native_dir , dos_to_native [ _dos_name ] ) ) ) ] if not to_kill : raise error . BASICError ( error . FILE_NOT_FOUND ) for dos_path in to_kill_dos : # don't delete open files self . require_file_not_open ( dos_path ) for native_path in to_kill : safe ( os . remove , native_path )