summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2013-01-06 15:34:12 +0100
committerMarc-André Lureau <marcandre.lureau@gmail.com>2013-01-06 16:38:27 +0100
commit36b14c8448e46e93cad7067d4249f2f005a7f6c7 (patch)
tree77463a754c8c582687a145939ca45ae2224da840
parentc116629cb6cdd5c9847859daf21e138265311fd9 (diff)
downloadmsitools-36b14c8448e46e93cad7067d4249f2f005a7f6c7.tar.gz
msitools-36b14c8448e46e93cad7067d4249f2f005a7f6c7.tar.xz
msitools-36b14c8448e46e93cad7067d4249f2f005a7f6c7.zip
Lookup files from various Builder.path
-rw-r--r--src/builder.vala31
-rw-r--r--src/wix.vala3
2 files changed, 30 insertions, 4 deletions
diff --git a/src/builder.vala b/src/builder.vala
index 04c1ed5..b546e0b 100644
--- a/src/builder.vala
+++ b/src/builder.vala
@@ -4,6 +4,7 @@ namespace Wixl {
public WixBuilder (WixRoot root) {
this.root = root;
+ add_path (".");
}
WixRoot root;
@@ -102,7 +103,7 @@ namespace Wixl {
if (f.DiskId != m.Id)
continue;
- folder.add_file (new GCab.File.with_file (f.Id, File.new_for_path (f.Name)), false);
+ folder.add_file (new GCab.File.with_file (f.Id, f.file), false);
var rec = f.record;
sequence += 1;
MsiTableFile.set_sequence (rec, sequence);
@@ -160,7 +161,10 @@ namespace Wixl {
}
public override void visit_icon (WixIcon icon) throws GLib.Error {
- db.table_icon.add (icon.Id, icon.SourceFile);
+ FileInfo info;
+
+ icon.file = find_file (icon.SourceFile, out info);
+ db.table_icon.add (icon.Id, icon.file.get_path ());
}
public override void visit_property (WixProperty prop) throws GLib.Error {
@@ -310,12 +314,31 @@ namespace Wixl {
COMPRESSED = 1 << 13
}
+ File? find_file (string name, out FileInfo info) throws GLib.Error {
+ info = null;
+
+ foreach (var p in path) {
+ var file = p.get_child (name);
+ try {
+ info = file.query_info ("standard::*", 0, null);
+ if (info != null)
+ return file;
+ } catch (IOError error) {
+ if (error is IOError.NOT_FOUND)
+ continue;
+ throw error;
+ }
+ }
+
+ throw new Wixl.Error.FAILED ("Couldn't find file %s", name);
+ }
+
public override void visit_file (WixFile file) throws GLib.Error {
return_if_fail (file.DiskId == "1");
var comp = file.parent as WixComponent;
- var gfile = File.new_for_path (file.Name);
- var info = gfile.query_info ("standard::*", 0, null);
+ FileInfo info;
+ file.file = find_file (file.Name, out info);
var attr = FileAttribute.VITAL;
var rec = db.table_file.add (file.Id, comp.Id, file.Name, (int)info.get_size (), attr);
diff --git a/src/wix.vala b/src/wix.vala
index 2b25f18..6b6bed8 100644
--- a/src/wix.vala
+++ b/src/wix.vala
@@ -203,6 +203,8 @@ namespace Wixl {
public string SourceFile { get; set; }
+ public File file;
+
public override void accept (WixElementVisitor visitor) throws GLib.Error {
visitor.visit_icon (this);
}
@@ -250,6 +252,7 @@ namespace Wixl {
public string Name { get; set; }
public Libmsi.Record record;
+ public File file;
public override void accept (WixElementVisitor visitor) throws GLib.Error {
base.accept (visitor);