system/src/sc/layer/LayerUtil.java
private static List<String> folderizeFileList(List<String> allClassFiles) {
      int ndirs = 1;
      Map<String, Object> dirList = new LinkedHashMap<String, Object>();
      for (String fileName:allClassFiles) {
         Map<String, Object> curDir = dirList;

         String fileRest = fileName;
         int slashIx;
         do {
            slashIx = fileRest.indexOf(FileUtil.FILE_SEPARATOR);
            if (slashIx != -1) {
               String dirName = fileRest.substring(0, slashIx);
               Object dirEnt = curDir.get(dirName);
               if (dirEnt instanceof String)
                  throw new IllegalArgumentException("File and directory with same name!" + dirEnt);
               Map<String,Object> nextDir = (Map<String,Object>) dirEnt;
               if (nextDir == null) {
                  nextDir = new LinkedHashMap<String,Object>();
                  ndirs++;
                  curDir.put(dirName, nextDir);
               }
               curDir = nextDir;
               fileRest = fileRest.substring(slashIx+1);
            }
         } while (slashIx != -1 && fileRest.length() > 0);

         if (fileRest.length() > 0) {
            curDir.put(fileRest, fileName);
         }
      }
      ArrayList<String> resFiles = new ArrayList<String>(allClassFiles.size() + ndirs);
      addFilesToSubList(resFiles, dirList, "");
      return resFiles;
   }
/**
    * Before creating a Jar file, we go through and order the files by directory name and include an entry for each directory.
    * For some reason, this makes a subtle difference in how IntelliJ processes Jar files from plugins - it won't recognize the file templates in the jar unless
    * we have things ordered this way - with an explicit entry for the folder.   There may be a specific check for that folder in the zip file?
    */
Before creating a Jar file, we go through and order the files by directory name and include an entry for each directory.
For some reason, this makes a subtle difference in how IntelliJ processes Jar files from plugins - it won't recognize the file templates in the jar unless
we have things ordered this way - with an explicit entry for the folder.
Before creating a Jar file we go through and order the files by directory name and include an entry for each directory . For some reason this makes a subtle difference in how IntelliJ processes Jar files from plugins - it won ' t recognize the file templates in the jar unless we have things ordered this way - with an explicit entry for the folder .
private static List<String> folderizeFileList(List<String> allClassFiles) {
      int ndirs = 1;
      Map<String, Object> dirList = new LinkedHashMap<String, Object>();
      for (String fileName:allClassFiles) {
         Map<String, Object> curDir = dirList;
         String fileRest = fileName;
         int slashIx;
         do {
            slashIx = fileRest.indexOf(FileUtil.FILE_SEPARATOR);
            if (slashIx != -1) {
               String dirName = fileRest.substring(0, slashIx);
               Object dirEnt = curDir.get(dirName);
               if (dirEnt instanceof String)
                  throw new IllegalArgumentException("File and directory with same name!" + dirEnt);
               Map<String,Object> nextDir = (Map<String,Object>) dirEnt;
               if (nextDir == null) {
                  nextDir = new LinkedHashMap<String,Object>();
                  ndirs++;
                  curDir.put(dirName, nextDir);
               }
               curDir = nextDir;
               fileRest = fileRest.substring(slashIx+1);
            }
         } while (slashIx != -1 && fileRest.length() > 0);
         if (fileRest.length() > 0) {
            curDir.put(fileRest, fileName);
         }
      }
      ArrayList<String> resFiles = new ArrayList<String>(allClassFiles.size() + ndirs);
      addFilesToSubList(resFiles, dirList, "");
      return resFiles;
   }
private static List < String > folderizeFileList ( List < String > allClassFiles ) { int ndirs = 1 ; Map < String , Object > dirList = new LinkedHashMap < String , Object > ( ) ; for ( String fileName : allClassFiles ) { Map < String , Object > curDir = dirList ; String fileRest = fileName ; int slashIx ; do { slashIx = fileRest . indexOf ( FileUtil . FILE_SEPARATOR ) ; if ( slashIx != - 1 ) { String dirName = fileRest . substring ( 0 , slashIx ) ; Object dirEnt = curDir . get ( dirName ) ; if ( dirEnt instanceof String ) throw new IllegalArgumentException ( "File and directory with same name!" + dirEnt ) ; Map < String , Object > nextDir = ( Map < String , Object > ) dirEnt ; if ( nextDir == null ) { nextDir = new LinkedHashMap < String , Object > ( ) ; ndirs ++ ; curDir . put ( dirName , nextDir ) ; } curDir = nextDir ; fileRest = fileRest . substring ( slashIx + 1 ) ; } } while ( slashIx != - 1 && fileRest . length ( ) > 0 ) ; if ( fileRest . length ( ) > 0 ) { curDir . put ( fileRest , fileName ) ; } } ArrayList < String > resFiles = new ArrayList < String > ( allClassFiles . size ( ) + ndirs ) ; addFilesToSubList ( resFiles , dirList , "" ) ; return resFiles ; }
Before creating a Jar file, we go through and order the files by directory name and include an entry for each directory.
Before creating a Jar file we go through and order the files by directory name and include an entry for each directory .