当用户确认应用程序卸载时,如何将特定文件夹的备份副本保存到用户桌面?
我尝试过但没有成功...也许有一种更简单的方法可以在不使用代码的情况下做到这一点...
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usUninstall then
begin
FileCopy('{app}\Profile\*', '{userdesktop}\Backup\Profile\', False);
end;
end;
感谢你们! :)
触发备份CurUninstallStepChanged(usUninstall)
是最好的解决方案。
您遇到的问题是:
随着使用DirectoryCopy
用户功能(来自上面提到的问题),你可以这样做:
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
SourcePath: string;
DestPath: string;
begin
if CurUninstallStep = usUninstall then
begin
SourcePath := ExpandConstant('{app}\Profile');
DestPath := ExpandConstant('{userdesktop}\Backup\Profile');
Log(Format('Backing up %s to %s before uninstallation', [
SourcePath, DestPath]));
if not ForceDirectories(DestPath) then
begin
Log(Format('Failed to create %s', [DestPath]));
end
else
begin
DirectoryCopy(SourcePath, DestPath);
end;
end;
end;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)