diff options
author | Marc-André Lureau <marcandre.lureau@gmail.com> | 2013-11-12 02:57:58 +0100 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@gmail.com> | 2013-11-12 02:57:58 +0100 |
commit | 922d85d1f89190537bc2c73fa22117d516ad1ba8 (patch) | |
tree | 3fd0488f1922b8329d8df4777a55d8c01b10fdb2 | |
parent | f5b7ac49999b1d843176eedb3dc880e8977a5d64 (diff) | |
download | msitools-922d85d1f89190537bc2c73fa22117d516ad1ba8.tar.gz msitools-922d85d1f89190537bc2c73fa22117d516ad1ba8.tar.xz msitools-922d85d1f89190537bc2c73fa22117d516ad1ba8.zip |
wixl: make component id generation more unique
Use a complete path for genenerating unique component id
-rw-r--r-- | tests/wixl.at | 6 | ||||
-rw-r--r-- | tools/wixl/builder.vala | 7 | ||||
-rw-r--r-- | tools/wixl/wix.vala | 13 |
3 files changed, 16 insertions, 10 deletions
diff --git a/tests/wixl.at b/tests/wixl.at index b6b1e82..378ddbf 100644 --- a/tests/wixl.at +++ b/tests/wixl.at @@ -43,9 +43,9 @@ AT_WIXLDATA([Manual.pdf]) AT_CHECK_WIXL([-o out.msi ComponentGUID.wxs], [0], [ignore], [ignore]) # FIXME: add tons of tests on out.msi AT_CHECK([msiinfo export -s out.msi Component | sort | grep INSERT], [0], -[INSERT INTO `Component` (`Component`, `ComponentId`, `Directory_`, `Attributes`, `KeyPath`) VALUES ('MainExecutable', '{824FE83A-F576-5626-8DB5-B460C2654825}', 'INSTALLDIR', 0, 'FoobarEXE') -INSERT INTO `Component` (`Component`, `ComponentId`, `Directory_`, `Attributes`, `KeyPath`) VALUES ('Manual', '{8CC39238-0EA7-5D8F-8E38-6E97FC9E2B09}', 'INSTALLDIR', 0, 'Manual') -INSERT INTO `Component` (`Component`, `ComponentId`, `Directory_`, `Attributes`, `KeyPath`) VALUES ('ProgramMenuDir', '{E3D82183-B8C9-5C35-A5F3-083D713C8CC2}', 'ProgramMenuDir', 4, 'reg87D9EA4ADD3AB0EF9CE081917EDEAAF5') +[INSERT INTO `Component` (`Component`, `ComponentId`, `Directory_`, `Attributes`, `KeyPath`) VALUES ('MainExecutable', '{0E066A5A-AE0E-5F43-B984-F6C685AF13F0}', 'INSTALLDIR', 0, 'FoobarEXE') +INSERT INTO `Component` (`Component`, `ComponentId`, `Directory_`, `Attributes`, `KeyPath`) VALUES ('Manual', '{BE256176-257D-5ACD-902D-801F8E305172}', 'INSTALLDIR', 0, 'Manual') +INSERT INTO `Component` (`Component`, `ComponentId`, `Directory_`, `Attributes`, `KeyPath`) VALUES ('ProgramMenuDir', '{F47E26A5-C6A8-57BA-B6B5-CB2AE74E5256}', 'ProgramMenuDir', 4, 'reg87D9EA4ADD3AB0EF9CE081917EDEAAF5') ]) AT_CLEANUP diff --git a/tools/wixl/builder.vala b/tools/wixl/builder.vala index 22233fe..9a6e738 100644 --- a/tools/wixl/builder.vala +++ b/tools/wixl/builder.vala @@ -675,12 +675,7 @@ namespace Wixl { file.DiskId = file.DiskId ?? "1"; return_if_fail (file.DiskId == "1"); - var name = file.Id; - if (file.Name != null) - name = file.Name; - else if (file.Source != null) - name = Path.get_basename (file.Source); - + var name = file.path_name (); var source = file.Source ?? name; var comp = file.parent as WixComponent; FileInfo info; diff --git a/tools/wixl/wix.vala b/tools/wixl/wix.vala index 5e290fb..6ccccf1 100644 --- a/tools/wixl/wix.vala +++ b/tools/wixl/wix.vala @@ -419,7 +419,7 @@ namespace Wixl { public File file; public override string path_name () throws GLib.Error { - return Name; + return Name ?? Path.get_basename (Source); } public override void accept (WixNodeVisitor visitor) throws GLib.Error { @@ -1093,6 +1093,17 @@ namespace Wixl { base.accept (visitor); visitor.visit_directory (this); } + + public string path_name () { + return Name ?? Id; + } + + public override string full_path (WixResolver r) throws GLib.Error { + if (parent != null && (parent is WixDirectory || parent is WixDirectoryRef)) + return parent.full_path (r) + "/" + path_name (); + else + return path_name (); + } } public class WixElementRef<G>: WixElement { |