版权声明: 可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息。
在某些情况下,安装包需要灵活,动态处理某些文件的安装路径,具体操作方法如下:
适用工程类型:InstallScript 和 InstallScript MSI
1. 在Setup Design视图中找到相对应的Component
2. 点击Destination的路径选择下拉菜单
3. 在Browse for Directory对话框中,选中Script-defined Folders点击鼠标右键选择New Directory,默认会产生一个<NEW_DIRECTORY1>。
4. 选中<NEW_DIRECTORY1>点击OK。
5. 在事件响应函数OnFirstUIBefore或OnBegin中添加如下代码:
function OnBegin()
string szCustomDirectory, szCustomLocation;
begin
// TODO: Perform custom initialization steps, check requirements, etc.
szCustomDirectory = "NEW_DIRECTORY1";
szCustomLocation = "D:\\Kevin Wan";
//(or path of your choice)
FeatureSetTarget(MEDIA, szCustomDirectory, szCustomLocation);
end;
string szCustomDirectory, szCustomLocation;
begin
// TODO: Perform custom initialization steps, check requirements, etc.
szCustomDirectory = "NEW_DIRECTORY1";
szCustomLocation = "D:\\Kevin Wan";
//(or path of your choice)
FeatureSetTarget(MEDIA, szCustomDirectory, szCustomLocation);
end;
6. 编译,运行安装包。
关于Basic MSI类型的工程,见后续文章《HOWTO:在安装包运行时指定Component的安装路径(续) - MSI》。