在Inno Setup中复制隐藏文件
问题描述:
如何在Inno Setup中使用复制隐藏的外部文件?不要隐藏文件,而要使用隐藏文件。因为现在:隐藏文件被忽略在Inno Setup中复制隐藏文件
任何帮助吗?谢谢)
[Files]
Source: "{src}\folder\*"; DestDir: "{app}"; \
Flags: skipifsourcedoesntexist external ignoreversion recursesubdirs createallsubdirs;
答
当您使用通配符选择[Files]
部分项文件,Inno Setup的安装程序明确跳过隐藏的文件。
你无法对此做任何事情。
见RecurseExternalCopyFiles
function in Projects\Install.pas
,特别是这部分:(。这是一个外部文件,因为这是你用什么,但对于编译时的文件,这是同样见Compile.pas
BuildFileList
)
if SourceIsWildcard then begin
if FindData.dwFileAttributes and FILE_ATTRIBUTE_HIDDEN <> 0 then
Continue; { <-- Skip hidden files, comment by @MartinPrikryl }
FileName := FindData.cFileName;
end
else
FileName := SearchWildcard; { use the case specified in the script }
。
所有你能做的,就是要实现[Code]
脚本自己安装,而不是使用[Files]
部分。
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssInstall then
begin
Log('Installing files');
DirectoryCopy(ExpandConstant('{src}\folder'), ExpandConstant('{app}'));
end;
end;
对于实施DirectoryCopy
,看到我的回答质疑Inno Setup: copy folder, subfolders and files recursively in Code section。
对于编译时文件(不external
标志),那么您可以使用a preprocessor function FindFirst
[Files]
条目列表。
+0
@ user3027198我已经添加了示例代码。 –
你需要更具体。 Inno Setup不关心文件是否隐藏,可以像其他文件一样被删除和替换。你想要做什么**具体**?请在您的[编辑]中加入安装脚本中的代码。如果您没有清楚解释问题,我们无法帮助您。 –
如果**文件夹**内的文件被隐藏 - 没有任何反应) – user3027198
'{src}'是**源**文件(设置中的文件)的路径。为什么你需要将它隐藏在**源**中? (你已经清楚地看到它,因为你自己将它添加到源代码中。)你的'[Files]'条目清楚地表明这些文件来自'{src} \ folder \',但是你试图从'{ SRC} \ file.txt'。并且请在问题本身中提供有关您问题的其他信息,而不是在评论中提供。 –