def test20_move_file(self): vfs.copy(self.root + 'tmp/blah.txt', self.root + 'tmp/blah.txt.bak') vfs.move(self.root + 'tmp/blah.txt.bak', self.root + 'tmp/blah.txt.old') file = vfs.open(self.root + 'tmp/blah.txt.old') self.assertEqual(file.read(), 'BLAH!!!') self.assertEqual(vfs.exists(self.root + 'tmp/blah.txt.bak'), False)
def OnEndEdit(self, evt): if evt.IsEditCancelled(): return item = evt.GetItem() old_path = self.GetPyData(item) new_name = evt.GetLabel() components = old_path.split('/') components.pop() dirname = '/'.join(components) new_path = dirname + '/' + new_name dprint("old=%s new=%s" % (old_path, new_path)) exists = MacroFS.getMacro(new_name) if exists: evt.Veto() wx.CallAfter(self.frame.showErrorDialog, "Cannot rename %s\%s already exists.") else: vfs.move("macro:%s" % old_path, "macro:%s" % new_path) self.SetPyData(item, new_path) RecentMacros.validateAll()
def test17_move_file(self): vfs.copy('vfs/hello.txt', 'vfs/hello.txt.bak') vfs.move('vfs/hello.txt.bak', 'vfs/hello.txt.old') file = vfs.open('vfs/hello.txt.old') self.assertEqual(file.read(), 'hello world\n') self.assertEqual(vfs.exists('vfs/hello.txt.bak'), False)
def test20_move_file(self): vfs.copy('mem:testfile.txt', 'mem:testfile.txt.bak') vfs.move('mem:testfile.txt.bak', 'mem:testfile.txt.old') file = vfs.open('mem:testfile.txt.old') self.assertEqual(file.read(), 'three\n') self.assertEqual(vfs.exists('mem:testfile.txt.bak'), False)
def test20_move_file(self): vfs.copy(self.root + "tmp/blah.txt", self.root + "tmp/blah.txt.bak") vfs.move(self.root + "tmp/blah.txt.bak", self.root + "tmp/blah.txt.old") file = vfs.open(self.root + "tmp/blah.txt.old") self.assertEqual(file.read(), "BLAH!!!") self.assertEqual(vfs.exists(self.root + "tmp/blah.txt.bak"), False)