Inno脚本:奇怪的空文件夹 [英] Inno Script: Strange Empty Folder
问题描述
我的Inno Script安装程序在C:驱动器中创建一个空文件夹,但仅在一台计算机上。我在该脚本上测试过的所有其他计算机都可以正常工作,而不会出现此问题。我已经在两台Windows 7计算机,一台XP计算机和一台Windows XP虚拟计算机上进行了测试。对于所有这些计算机,安装程序都不会创建此空文件夹。
My Inno Script installer makes an empty folder in the C: drive but only on one machine. Every other machine I've tested the script on works without this problem. I've tested on two Windows 7 computers, an XP computer and a Windows XP virtual computer. For all of these computers the installer doesn't create this empty folder.
但是,在我同事的Windows XP计算机上,安装程序会按照应有的方式运行,除了还会创建一个C驱动器上的空目录。卸载并不会删除该文件夹。
However, on my colleague's Windows XP computer the installer behaves as it should except that it also creates an empty directory on the C Drive. Uninstalling does not remove the folder.
我浏览了一下脚本,寻找了可能创建额外文件夹的内容,但是我看不到任何东西。因为我似乎无法复制问题,所以这特别难以解决。
I've had a look through my script and looked for things that could possibly be creating the extra folder, but I can't see anything. It's especially hard to solve because I can't seem to replicate the problem.
这里的任何人都知道为什么会发生这种情况吗?
Does anyone here have an idea of why this could be happening?
#define MyAppName "Program1"
#define MyAppVersion "1.0"
#define MyAppExeName "program1.exe"
[Setup]
AppName=Test
AppVersion=1.0
AppPublisher=Me
AppSupportURL=www.google.com
AppUpdatesURL= www.google.com
DefaultDirName={code:getDirectory}
UsePreviousAppDir=no
DisableDirPage=yes
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
OutputBaseFilename={#MyAppName} {#MyAppVersion} Setup
Compression=lzma
SolidCompression=yes
OutputDir=output
UninstallFilesDir={code:getDirectory}
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "german"; MessagesFile: "compiler:Languages\German.isl"
[Files]
Source: "test.iss"; DestDir: "{code:getDirectory}"; Flags: ignoreversion;
[Code]
var
InstallTestVersionCheckBox: TNewCheckBox;
Directory : string;
// ------------------------------
// INSTALL
// ------------------------------
procedure InitializeWizard;
var
MainPage: TWizardPage;
begin
MainPage := CreateCustomPage(wpWelcome, 'text', 'text');
// make the checkbox
InstallTestVersionCheckBox := TNewCheckBox.Create(MainPage);
InstallTestVersionCheckBox.Parent := MainPage.Surface;
InstallTestVersionCheckBox.Caption := 'Test Version';
end;
function InstallTestVersion: Boolean;
begin
Result := InstallTestVersionCheckBox.Checked;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if InstallTestVersion() then
begin
// Set the test version directory
Directory := ExpandConstant('{pf32}\Testversion');
end
else
begin
// Set the production version directory
Directory := ExpandConstant('{pf32}\Normal');
end;
end;
// Returns the correct directory
function getDirectory(Param: String): String;
begin
Result := Directory;
end;
推荐答案
对于可能会遇到类似问题的用户:Inno setup突然创建了我不想拥有的其他空文件夹。最终,我明白了原因:我试图在[Files]节中创建一个空文件夹。那不是个好主意……因此,您只需要使用[Dirs]部分创建空文件夹就可以了。
For those who might run into similar problems: Inno setup suddenly created additional empty folders I didn't want to have. Finally I understood the reason: I tried to create a single empty folder within the [Files] section. That was no good idea... So you just create your empty folder with the [Dirs] section to do it the good way.
不要这样做:
[Files]
Source: "M:\My_Empty_Folder"; DestDir: "{userdocs}\My_App_Name"; Flags: ignoreversion
这更好:
[Dirs]
Name: "{userdocs}\My_App_Name\My_Empty_Folder"
这篇关于Inno脚本:奇怪的空文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!