Changeset 1722

Show
Ignore:
Timestamp:
05/02/07 10:39:40 (2 years ago)
Author:
dsugar
Message:

better checks for existing stuff on disc before attempting to create it again. It could already
exist if the project is being recreated.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/framework-plugin/src/com/tresys/framework/plugin/wizards/NewProjectWizard.java

    r1694 r1722  
    104104 
    105105                                IFile makeFile = buildDir.getFile(FrameworkNature.m_makeFile); 
    106                                  
    107                                 String sPath = FrameworkNature.m_resourcesDir 
    108                                                  + IPath.SEPARATOR + FrameworkNature.m_buildDir 
    109                                                  + IPath.SEPARATOR + FrameworkNature.m_makeFile; 
    110                                 URL basePathURL = SEFramework_Plugin.getDefault().getBundle().getEntry(sPath); 
    111  
    112                                 InputStream streamMakefile = basePathURL.openStream(); 
    113                                 makeFile.create(streamMakefile, true, null); 
     106                                if (!makeFile.exists()) 
     107                                { 
     108                                        String sPath = FrameworkNature.m_resourcesDir 
     109                                                         + IPath.SEPARATOR + FrameworkNature.m_buildDir 
     110                                                         + IPath.SEPARATOR + FrameworkNature.m_makeFile; 
     111                                        URL basePathURL = SEFramework_Plugin.getDefault().getBundle().getEntry(sPath); 
     112         
     113                                        InputStream streamMakefile = basePathURL.openStream(); 
     114                                        makeFile.create(streamMakefile, true, null); 
     115                                } 
    114116                        } 
    115117                        catch (Exception e) 
     
    126128                                        confDir.create(true, false, null); 
    127129 
    128                                 IFile specFile = confDir.getFile(FrameworkNature.m_specFile);  
    129                                 String sPath = FrameworkNature.m_resourcesDir  
    130                                         + IPath.SEPARATOR + FrameworkNature.m_confDir 
    131                                         + IPath.SEPARATOR + FrameworkNature.m_specFile; 
    132                                 URL basePathURL = SEFramework_Plugin.getDefault().getBundle().getEntry (sPath); 
    133  
    134                                 /*Create a blank file 'selinux_policy.spec'*/ 
    135                                 InputStream streamSpecfile = basePathURL.openStream(); 
    136                                 specFile.create(streamSpecfile, true, null); 
     130                                IFile specFile = confDir.getFile(FrameworkNature.m_specFile); 
     131                                if (!specFile.exists()) 
     132                                { 
     133                                        String sPath = FrameworkNature.m_resourcesDir  
     134                                                + IPath.SEPARATOR + FrameworkNature.m_confDir 
     135                                                + IPath.SEPARATOR + FrameworkNature.m_specFile; 
     136                                        URL basePathURL = SEFramework_Plugin.getDefault().getBundle().getEntry (sPath); 
     137         
     138                                        /*Create a blank file 'selinux_policy.spec'*/ 
     139                                        InputStream streamSpecfile = basePathURL.openStream(); 
     140                                        specFile.create(streamSpecfile, true, null); 
     141                                } 
    137142                        } 
    138143                        catch (Exception e) 
  • trunk/framework-plugin/src/com/tresys/framework/plugin/wizards/NewSystemWizard.java

    r1694 r1722  
    155155                        try 
    156156                        { 
    157                                 String sPath = FrameworkNature.m_resourcesDir + IPath.SEPARATOR + FrameworkNature.m_supportMacroFile; 
    158                                 URL basePathURL = SEFramework_Plugin.getDefault().getBundle().getEntry(sPath); 
    159157                                 
    160158//                              IContainer policyDir = nat.getSupportMacroIFolder(frameDir);  //TODO: future!! added in 1.1.11  of SLIDE 
    161159                                IFile supportFile = systemDir.getFile("policy/support/" + FrameworkNature.m_supportMacroFile); //$NON-NLS-1$ 
    162          
    163                                 InputStream supportFileStream = basePathURL.openStream(); 
    164                                 supportFile.create(supportFileStream, true, null); 
    165  
     160 
     161                                if (!supportFile.exists()) 
     162                                { 
     163                                        String sPath = FrameworkNature.m_resourcesDir + IPath.SEPARATOR + FrameworkNature.m_supportMacroFile; 
     164                                        URL basePathURL = SEFramework_Plugin.getDefault().getBundle().getEntry(sPath); 
     165                                        InputStream supportFileStream = basePathURL.openStream(); 
     166                                        supportFile.create(supportFileStream, true, null); 
     167                                } 
     168                                 
    166169                                File buildConfFile = nat.GetBuildConfPath (frameDir); 
    167170                                if (buildConfFile.exists())