def test_mknod_write(self): path = '/memory/Sample100.wav' f = self.fs.open('/memory/Sample100.wav', 'wb') f.write('abc') f.close() written = os.open(common._create_cache_path(path), os.O_RDONLY) try: self.assertEquals('abc', os.read(written, 3)) finally: os.close(written)
def test_mknod_write(self): path = '/memory/Sample100.wav' self.fs.mknod(path, 0, 'ignored') afile = aksyfuse.AksyFile('/memory/Sample100.wav', os.O_WRONLY|S_IRUSR) afile.write('abc', 0) afile.release('ignored') written = os.open(common._create_cache_path(path), os.O_RDONLY) try: self.assertEquals('abc', os.read(written, 3)) finally: os.close(written)
def test_mknod_write(self): path = '/memory/Sample100.wav' self.fs.mknod(path, 0, 'ignored') afile = aksyfuse.AksyFile('/memory/Sample100.wav', os.O_WRONLY | S_IRUSR | os.O_CREAT) afile.write('abc', 0) afile.release('ignored') written = os.open(common._create_cache_path(path), os.O_RDONLY) try: self.assertEquals('abc', os.read(written, 3)) finally: os.close(written)
def __init__(self, path, flags, *mode): self.direct_io = True self.upload = bool(flags & os.O_WRONLY) self.name = os.path.basename(path) location = common._splitpath(path)[0] if location == "memory": self.location = samplermod.AkaiSampler.MEMORY elif location == "disks": self.location = samplermod.AkaiSampler.DISK else: raiseException(errno.ENOENT) self.path = common._create_cache_path(path) if not self.is_upload() and not common._cache_path_exists(path): AksyFile.sampler.transfertools.get(self.name, self.path, self.location) self.handle = os.open(self.path, flags, *mode)