def CopyFile(self, src, dst):
if os.path.isfile(src):
src_folder, src_filename = os.path.split(src)
if os.path.isfile(dst):
dst_folder, dst_filename = os.path.split(dst)
else:
dst_folder = dst
dst_filepath = os.path.join(dst_folder, src_filename)
if os.path.isfile(dst_filepath):
dialog = wx.MessageDialog(
self,
_("The file '%s' already exist.\nDo you want to replace it?") % src_filename,
_("Replace File"), wx.YES_NO | wx.ICON_QUESTION)
copy = dialog.ShowModal() == wx.ID_YES
dialog.Destroy()
else:
copy = True
if copy:
shutil.copyfile(src, dst_filepath)
return dst_filepath
return None
评论列表
文章目录