Changeset 49

Show
Ignore:
Timestamp:
06/19/08 12:46:06 (6 months ago)
Author:
bi..@lilyapp.org
Message:

add option to save as dialog to copy the contents of the patch's parent directory to app/addon.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lily/lily/chrome/content/exportDialog.xul

    r14 r49  
    128128                                                <label control="description" value="Description"/> 
    129129                                                <textbox multiline="true" id="description" value="Made with Lily."/>                                             
    130                                         </row>                                                                                                   
     130                                        </row> 
     131                                        <row id="includeParDirRow"> 
     132                                                <hbox></hbox> 
     133                                                <hbox> 
     134                                                        <label control="includeParentDir" value="Include the contents of the patch's parent directory?"/> 
     135                                                        <checkbox checked="false" id="includeParentDirCbx"/> 
     136                                                </hbox>                                          
     137                                        </row>                                                                                                                                           
    131138                                </rows> 
    132139                        </grid> 
  • trunk/lily/lily/chrome/content/exporter.js

    r38 r49  
    534534                data=data.replace(/chrome:\/\/lily/g,("chrome://"+projectName)); 
    535535                Lily.patchObj[id].json=data; //update the patch string.                  
    536                 tmp=LilyUtils.writeFile(tmp,data);                                      
    537  
     536                tmp=LilyUtils.writeFile(tmp,data);       
     537         
    538538                //copy subpatches 
     539                //******* FIXME ******** won't work with absolute paths, won't work with subfolders. 
    539540                var subPatchArr = dependencies["subPatches"];                                                                            
    540541                for(var i=0;i<subPatchArr.length;i++) { 
     
    546547                                LilyUtils.writeFile(tmpOut,LilyUtils.readFile(tmpIn));   
    547548                        } 
    548                 }                                                                                                                                                                                                                                                                
     549                } 
     550                 
     551                //copy the patch's parent directory if we need to and if the patch has been saved. 
     552                //******* FIXME ********  won't work with absolute paths, won't work with subfolders.                                                                                                                                                                                                                                                            
     553                if(obj.includeParentDirCbx && Lily.patchObj[id].file) { 
     554                         
     555                        //copy the patch's parent dir 
     556                        var parentDir = Lily.patchObj[id].file.parent.clone(); 
     557 
     558                        //recurse thru the resources dir converting text files as needed. 
     559                        LilyUtils.directorySearch(parentDir,function(file) { 
     560 
     561                                var tmpOut = contentOut.clone(); 
     562                                var testExist = contentOut.clone();                                              
     563                                testExist.append(file.leafName); 
     564                                 
     565                                if(!testExist.exists()) { 
     566                                        if(LilyUtils.isText(file.leafName)) { 
     567                                                tmpOut.append(file.leafName);                                                    
     568                                                LilyUtils.writeFile(tmpOut,LilyUtils.readFile(file).replace(/chrome:\/\/lily/g,("chrome://"+projectName)));                                                      
     569                                        } else { 
     570                                                file.copyTo(tmpOut,null); 
     571                                        }        
     572                                }                                                        
     573                        }) 
     574                } 
    549575 
    550576                /* END CONTENT COPYING */ 
     
    600626                         
    601627                        var rootDir = fp.file.parent.clone();   //Lily.installDir.clone(); 
    602                         rootDir.append(projectName+"_tmp"); 
     628                        rootDir.append("."+projectName+"_tmp"); 
    603629                         
    604630                        if( !rootDir.exists() || !rootDir.isDirectory() ) {   // if it doesn't exist, create 
     
    866892                                                LilyUtils.writeFile(tmpOut,LilyUtils.readFile(tmpIn)); 
    867893                                        } 
    868                                 }                                                                                                                                                                                                                                                                
     894                                } 
     895                                 
     896                                //copy the patch's parent directory if we need to and if the patch has been saved. 
     897                                //******* FIXME ********  won't work with absolute paths, won't work with subfolders.                                                                                                                                                                                                                                                            
     898                                if(obj.includeParentDirCbx && Lily.patchObj[id].file) { 
     899 
     900                                        //copy the patch's parent dir 
     901                                        var parentDir = Lily.patchObj[id].file.parent.clone(); 
     902 
     903                                        //recurse thru the resources dir converting text files as needed. 
     904                                        LilyUtils.directorySearch(parentDir,function(file) { 
     905 
     906                                                var tmpOut = contentOut.clone(); 
     907                                                var testExist = contentOut.clone();                                              
     908                                                testExist.append(file.leafName); 
     909                                                 
     910                                                if(!testExist.exists()) { 
     911                                                        if(LilyUtils.isText(file.leafName)) { 
     912                                                                tmpOut.append(file.leafName);                                                    
     913                                                                LilyUtils.writeFile(tmpOut,LilyUtils.readFile(file).replace(/chrome:\/\/lily/g,("chrome://"+projectName)));                                                      
     914                                                        } else { 
     915                                                                file.copyTo(tmpOut,null); 
     916                                                        }        
     917                                                } 
     918                                                         
     919                                        }) 
     920                                }                                                                                                                                                                                                                                                                                                
    869921                                 
    870922                                /* END CONTENT COPYING */