Changeset 99

Show
Ignore:
Timestamp:
08/17/08 20:48:47 (4 months ago)
Author:
bi..@lilyapp.org
Message:

fix a bug in saveas.
fix exporter again after the last changes
add error reporting to run in background

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lily/lily/chrome/content/exporter.js

    r95 r99  
    316316                if( !xulOut.exists() || !xulOut.isDirectory() ) {   // if it doesn't exist, create 
    317317                        xulOut.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0777); 
    318                 }                                
     318                } 
     319                 
     320                var configIn = contentIn.clone(); 
     321                configIn.append("config"); 
     322                                 
     323                //create the config directory 
     324                var configOut = rootDir.clone(); 
     325                configOut.append("chrome");              
     326                configOut.append("content"); 
     327                configOut.append("config"); 
     328                 
     329                if(!configOut.exists()) {   // if it doesn't exist, create 
     330                        configOut.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0777); 
     331                }                                        
    319332 
    320333                //apikey 
     
    332345                config["extID"] = (projectName+".id@"+projectName+".com"); 
    333346                config["openDebugWin"] = (!obj.hideDebugCbx); 
    334                 var tmpOut = contentOut.clone(); 
    335                 tmpOut.append("config");                 
     347                var tmpOut = configOut.clone();          
    336348                tmpOut.append("config.txt");                             
    337349                LilyUtils.writeFile(tmpOut,config.toSource());   
     
    392404 
    393405                //keys.txt 
    394                 var tmp = contentIn.clone(); 
    395                 tmp.append("config"); 
     406                var tmp = configIn.clone(); 
    396407                tmp.append("keys.txt"); 
    397                 tmp.copyTo(contentOut,null); 
     408                tmp.copyTo(configOut,null); 
    398409                 
    399410                //keys.js 
     
    403414                 
    404415                //font-compat.txt 
    405                 var tmp = contentIn.clone(); 
    406                 tmp.append("config");            
     416                var tmp = configIn.clone();      
    407417                tmp.append("font-compat.txt"); 
    408                 tmp.copyTo(contentOut,null);           
     418                tmp.copyTo(configOut,null);            
    409419 
    410420                //lib 
     
    443453                tmp.append("menus.js"); 
    444454                tmp.copyTo(contentOut,null); 
    445  
    446                 //model.js 
    447                 var tmp = contentIn.clone(); 
    448                 tmp.append("model.js"); 
     455                 
     456                //external.js 
     457                var tmp = contentIn.clone(); 
     458                tmp.append("externals.js"); 
    449459                tmp.copyTo(contentOut,null); 
    450  
    451                 //object.js 
    452                 var tmp = contentIn.clone(); 
    453                 tmp.append("object.js"); 
    454                 tmp.copyTo(contentOut,null); 
    455                  
    456                 //external.js 
    457                 var tmp = contentIn.clone(); 
    458                 tmp.append("externals.js"); 
     460                 
     461                //object 
     462                var tmp = contentIn.clone(); 
     463                tmp.append("object"); 
    459464                tmp.copyTo(contentOut,null);             
    460  
    461                 //patch.js 
    462                 var tmpIn = contentIn.clone(); 
    463                 tmpIn.append("patch.js"); 
    464                 var tmpOut = contentOut.clone(); 
    465                 tmpOut.append("patch.js");                               
    466                 LilyUtils.writeFile(tmpOut,LilyUtils.readFile(tmpIn).replace(/chrome:\/\/lily/g,("chrome://"+projectName))); 
    467  
     465                 
     466                //patch 
     467                var patchArr = [ 
     468                        "model.js", 
     469                        "base.js", 
     470                        "controller.js", 
     471                        "view.js" 
     472                ]; 
     473                 
     474                var patchOut = contentOut.clone(); 
     475                patchOut.append("patch"); 
     476 
     477                if( !patchOut.exists() || !patchOut.isDirectory() ) {   // if it doesn't exist, create 
     478                   patchOut.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0777); 
     479                } 
     480 
     481                for(var i=0;i<patchArr.length;i++) { 
     482                        var tmpIn = contentIn.clone(); 
     483                        tmpIn.append("patch"); 
     484                        tmpIn.append(patchArr[i]);                       
     485 
     486                        var tmpOut = contentOut.clone(); 
     487                        tmpOut.append("patch"); 
     488                        tmpOut.append(patchArr[i]);      
     489 
     490                        var data = LilyUtils.readFile(tmpIn); 
     491                        data = data.replace(/chrome:\/\/lily/g,("chrome://"+projectName));               
     492                        LilyUtils.writeFile(tmpOut,data); 
     493                }                
     494                 
    468495                //patch.xhtml 
    469496                var tmp = contentIn.clone(); 
     
    747774                                } 
    748775                                 
     776                                var configIn = contentIn.clone(); 
     777                                configIn.append("config");                               
     778                                 
     779                                //create the config directory 
     780                                var configOut = rootDir.clone(); 
     781                                configOut.append("chrome");              
     782                                configOut.append("content"); 
     783                                configOut.append("config"); 
     784                                 
     785                                if(!configOut.exists()) {   // if it doesn't exist, create 
     786                                        configOut.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0777); 
     787                                }                                
     788                                 
    749789                                //apikey 
    750790                                var tmp = xulIn.clone(); 
     
    764804                                config["extID"] = emailValue; 
    765805                                config["openDebugWin"] = (!obj.hideDebugCbx);                            
    766                                 var tmpOut = contentOut.clone(); 
    767                                 tmpOut.append("config");                                 
     806                                var tmpOut = configOut.clone();                          
    768807                                tmpOut.append("config.txt");                             
    769808                                LilyUtils.writeFile(tmpOut,config.toSource());                                                                                   
     
    830869                                 
    831870                                //keys.txt 
    832                                 var tmp = contentIn.clone(); 
    833                                 tmp.append("config"); 
     871                                var tmp = configIn.clone(); 
    834872                                tmp.append("keys.txt"); 
    835                                 tmp.copyTo(contentOut,null); 
     873                                tmp.copyTo(configOut,null); 
    836874                                                 
    837875                                //keys.js 
     
    841879                                 
    842880                                //font-compat.txt 
    843                                 var tmp = contentIn.clone(); 
     881                                var tmp = configIn.clone();                             
    844882                                tmp.append("font-compat.txt"); 
    845                                 tmp.copyTo(contentOut,null);                           
     883                                tmp.copyTo(configOut,null);                            
    846884                                 
    847885                                //lib 
     
    881919                                tmp.copyTo(contentOut,null); 
    882920                                 
    883                                 //model.js 
    884                                 var tmp = contentIn.clone(); 
    885                                 tmp.append("model.js"); 
    886                                 tmp.copyTo(contentOut,null); 
    887  
    888                                 //object.js 
    889                                 var tmp = contentIn.clone(); 
    890                                 tmp.append("object.js"); 
    891                                 tmp.copyTo(contentOut,null); 
    892                                  
    893921                                //external.js 
    894922                                var tmp = contentIn.clone(); 
     
    896924                                tmp.copyTo(contentOut,null);                             
    897925                                 
    898                                 //patch.js 
    899                                 var tmpIn = contentIn.clone(); 
    900                                 tmpIn.append("patch.js"); 
    901                                 var tmpOut = contentOut.clone(); 
    902                                 tmpOut.append("patch.js");                               
    903                                 LilyUtils.writeFile(tmpOut,LilyUtils.readFile(tmpIn).replace(/chrome:\/\/lily/g,("chrome://"+projectName))); 
     926                                //object 
     927                                var tmp = contentIn.clone(); 
     928                                tmp.append("object"); 
     929                                tmp.copyTo(contentOut,null);             
     930 
     931                                //patch 
     932                                var patchArr = [ 
     933                                        "model.js", 
     934                                        "base.js", 
     935                                        "controller.js", 
     936                                        "view.js" 
     937                                ]; 
     938 
     939                                var patchOut = contentOut.clone(); 
     940                                patchOut.append("patch"); 
     941 
     942                                if( !patchOut.exists() || !patchOut.isDirectory() ) {   // if it doesn't exist, create 
     943                                   patchOut.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0777); 
     944                                } 
     945 
     946                                for(var i=0;i<patchArr.length;i++) { 
     947                                        var tmpIn = contentIn.clone(); 
     948                                        tmpIn.append("patch"); 
     949                                        tmpIn.append(patchArr[i]);                       
     950 
     951                                        var tmpOut = contentOut.clone(); 
     952                                        tmpOut.append("patch"); 
     953                                        tmpOut.append(patchArr[i]);      
     954 
     955                                        var data = LilyUtils.readFile(tmpIn); 
     956                                        data = data.replace(/chrome:\/\/lily/g,("chrome://"+projectName));               
     957                                        LilyUtils.writeFile(tmpOut,data); 
     958                                }                
    904959                                 
    905960                                //patch.xhtml 
  • trunk/lily/lily/chrome/content/lily.js

    r90 r99  
    880880        Lily.getCurrentPatch().patchView.xulWin.openDialog("chrome://lily/content/xul/exportDialog.xul", "lilyExportDialog", "chrome,titlebar,toolbar,centerscreen,modal",exportParams);                 
    881881 
    882                 Lily.getCurrentPatch().patchView.showWindowStatusActivity(true); 
    883                 Lily.getCurrentPatch().patchView.setWindowStatusText("Saving as addon...") 
    884  
    885882                if(exportParams.saved) { 
     883                        Lily.getCurrentPatch().patchView.showWindowStatusActivity(true); 
     884                        Lily.getCurrentPatch().patchView.setWindowStatusText("Saving as addon...")                       
    886885                        LilyUtils.runInBackGround(function(){ 
    887886                                LilyPatchExporter.savePatchAsAddOn(exportParams);        
     
    907906        Lily.getCurrentPatch().patchView.xulWin.openDialog("chrome://lily/content/xul/exportDialog.xul", "lilyExportDialog", "chrome,titlebar,toolbar,centerscreen,modal",exportParams);                         
    908907                 
    909                 Lily.getCurrentPatch().patchView.showWindowStatusActivity(true); 
    910                 Lily.getCurrentPatch().patchView.setWindowStatusText("Saving as app...") 
    911  
    912908                if(exportParams.saved) { 
     909                        Lily.getCurrentPatch().patchView.showWindowStatusActivity(true); 
     910                        Lily.getCurrentPatch().patchView.setWindowStatusText("Saving as app...")                         
    913911                        LilyUtils.runInBackGround(function(){ 
    914912                                LilyPatchExporter.savePatchAsApp(exportParams);  
  • trunk/lily/lily/chrome/content/utils/core.js

    r96 r99  
    557557              main.dispatch(new mainThread(this.threadID, this.result), 
    558558                background.DISPATCH_NORMAL); 
    559             } catch(err) { 
    560               Components.utils.reportError(err); 
     559            } catch(e) { 
     560              Components.utils.reportError(e); 
     561                  LilyDebugWindow.error(e.name+": "+e.message+" line: "+e.lineNumber+" in "+e.fileName); 
    561562            } 
    562563          }, 
     
    582583              // This is where we react to the completion of the working thread. 
    583584                        cb(this.threadID,this.result); 
    584             } catch(err) { 
    585               Components.utils.reportError(err); 
     585            } catch(e) { 
     586              Components.utils.reportError(e); 
     587                  LilyDebugWindow.error(e.name+": "+e.message+" line: "+e.lineNumber+" in "+e.fileName);                         
    586588            } 
    587589          },