summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2013-01-08 22:28:48 +0100
committerMarc-André Lureau <marcandre.lureau@gmail.com>2013-01-08 22:28:48 +0100
commitddd2cc0291e1b78e6dd83246135148489719f300 (patch)
tree68bc145c02a0dddd25320742fdf02e193528c694
parent4fe4b5fe781b62b93ec484617c92c0581498512e (diff)
downloadmsitools-ddd2cc0291e1b78e6dd83246135148489719f300.tar.gz
msitools-ddd2cc0291e1b78e6dd83246135148489719f300.tar.xz
msitools-ddd2cc0291e1b78e6dd83246135148489719f300.zip
Generate UUID for Product Id="*"
-rw-r--r--src/builder.vala2
-rw-r--r--src/msi.vala3
-rw-r--r--src/util.vala13
3 files changed, 14 insertions, 4 deletions
diff --git a/src/builder.vala b/src/builder.vala
index 0cbfdf1..995865f 100644
--- a/src/builder.vala
+++ b/src/builder.vala
@@ -213,7 +213,7 @@ namespace Wixl {
db.table_property.add ("Manufacturer", product.Manufacturer);
db.table_property.add ("ProductLanguage", product.Language);
- db.table_property.add ("ProductCode", add_braces (product.Id));
+ db.table_property.add ("ProductCode", get_uuid (product.Id));
db.table_property.add ("ProductName", product.Name);
db.table_property.add ("ProductVersion", product.Version);
db.table_property.add ("UpgradeCode", add_braces (product.UpgradeCode));
diff --git a/src/msi.vala b/src/msi.vala
index a2dadaf..a73fd73 100644
--- a/src/msi.vala
+++ b/src/msi.vala
@@ -469,8 +469,7 @@ namespace Wixl {
info.set_property (Libmsi.Property.TEMPLATE, "Intel;1033");
info.set_property (Libmsi.Property.KEYWORDS, "Installer");
info.set_property (Libmsi.Property.CODEPAGE, 1252);
- info.set_property (Libmsi.Property.UUID,
- add_braces (uuid_generate ()));
+ info.set_property (Libmsi.Property.UUID, get_uuid ("*"));
info.set_property (Libmsi.Property.CREATED_TM,
time_to_filetime (now ()));
info.set_property (Libmsi.Property.LASTSAVED_TM,
diff --git a/src/util.vala b/src/util.vala
index 7235e3f..f8952b2 100644
--- a/src/util.vala
+++ b/src/util.vala
@@ -23,7 +23,6 @@ namespace Wixl {
return (string) udn;
}
-
int enum_from_string (Type t, string str) throws GLib.Error {
var k = (EnumClass)t.class_ref ();
var v = k.get_value_by_nick (str);
@@ -34,9 +33,21 @@ namespace Wixl {
}
string add_braces (string str) {
+ if (str[0] == '{')
+ return str;
+
return "{" + str + "}";
}
+ string get_uuid (owned string uuid) throws GLib.Error {
+ if (uuid == "*")
+ uuid = uuid_generate ();
+ uuid = add_braces (uuid);
+ uuid = uuid.up ();
+ // FIXME: validate
+ return uuid;
+ }
+
long now () {
var tv = TimeVal ();
tv.get_current_time ();