FileManagementPanel.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:beremiz 作者: nucleron 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号