JSDOC/Packer.vala
[gnome.introspection-doc-generator] / JSDOC / Packer.vala
index 472932a..2002ecf 100644 (file)
@@ -56,7 +56,9 @@ x.packAll();  // writes files  etc..
  */
 namespace JSDOC 
 {
-
+       public errordomain PackerError {
+            ArgumentError
+    }
 
        public class Packer : Object 
        {
@@ -125,7 +127,7 @@ namespace JSDOC
                public void pack()
                {
                    if (this.files.size < 1) {
-                               throw new Packer.ArgumentError("No Files loaded before pack() called");
+                               throw new PackerError.ArgumentError("No Files loaded before pack() called");
                        }
                        if (this.target.length > 0 ) {
                                this.targetStream = File.new_for_path(this.target).replace(null, false,FileCreateFlags.NONE);
@@ -175,10 +177,10 @@ namespace JSDOC
                                // should we prefix? =- or should this be done elsewhere?
                                
                        var add = f.replace(".", "/") + ".js";
-                       if (_this.files.contains(add)) {
+                       if (this.files.contains(add)) {
                            continue;
                        }
-                       _this.files.add( add );
+                       this.files.add( add );
                        
                    }
                }
@@ -190,12 +192,14 @@ namespace JSDOC
                    //this.transOrigFile= bpath + '/../lang.en.js'; // needs better naming...
                    //File.write(this.transfile, "");
                    if (this.target.length > 0) {
-                       this.targetStream.write("");
+                       this.targetStream.write("".data);
                    }
                    
-                   if (this.debugTarget > 0) {
-                           this.targetDebugStream.write("");
+                   if (this.targetDebugStream != null) {
+                           this.targetDebugStream.write("".data);
                    }
+                   
+                   
                    foreach(var file in this.files) {
                        
                        print("reading %s\n",file );
@@ -212,7 +216,7 @@ namespace JSDOC
                        if (this.targetDebugStream !=null) {
                                
                                FileUtils.get_contents(file,out file_contents);
-                           this.targetDebugStream.write(file_contents);
+                           this.targetDebugStream.write(file_contents.data);
                            loaded_string = false;
                        }
                        // it's a good idea to check with 0 compression to see if the code can parse!!
@@ -222,7 +226,7 @@ namespace JSDOC
                        
                   
                        
-                       var minfile = this.tmpDir + '/' + file.replace("/", '.');
+                       var minfile = this.tmpDir + "/" + file.replace("/", ".");
                        
                        
                        // let's see if we have a min file already?
@@ -311,9 +315,9 @@ namespace JSDOC
                    */
                    print("MERGING SOURCE");
                    
-                   for(var i=0; i < this.files.length; i++)  {
+                   for(var i=0; i < this.files.size; i++)  {
                        var file = this.files[i];
-                       var minfile = this.tmpDir + '/' + file.replace('/', '.');
+                       var minfile = this.tmpDir + "/" + file.replace("/", ".");
                        
                        
                        if (!File.exists(minfile)) {