system/src/sc/layer/LayeredSystem.java
private Layer initLayer(String layerPathName, String relDir, String relPath, boolean markDynamic, LayerParamInfo lpi) {
      String prefix = null;
      String origLayerPathName = layerPathName;
      Layer layer = findLayerInPath(layerPathName, relDir, null, markDynamic, lpi);
      int ix;
      /* TODO: remove this? not sure what it was doing but it can cause weird errors if a layer is not found and some
       * component part of the path matches - e.g. if we are trying to resolve content.html.core it will find html.core
       * and complain that the layer name does not match
      while (layer == null && (ix = layerPathName.indexOf(".")) != -1) {
         prefix = CTypeUtil.prefixPath(prefix, layerPathName.substring(0, ix));
         layerPathName = layerPathName.substring(ix+1);
         layer = findLayerInPath(layerPathName, relDir, prefix, markDynamic, lpi);
         if (layer != null)
            System.out.println("*** Weird case of returning prefixed layer: " + layerPathName + " relDir: " + relDir);
      }
      */

      if (layer == null && relPath != null) {
         // relPath NOT propagated here
         layer = findLayerInPath(CTypeUtil.prefixPath(relPath, origLayerPathName), relDir, null, markDynamic, lpi);
      }

      if (layer == null) {
         origLayerPathName = origLayerPathName.replace('.',FileUtil.FILE_SEPARATOR_CHAR);
         String layerBaseName = FileUtil.addExtension(FileUtil.getFileName(origLayerPathName), SCLanguage.STRATACODE_SUFFIX);
         String layerFileName = FileUtil.concat(origLayerPathName, layerBaseName);
         File layerPathFile = new File(layerFileName);
         if (lpi.activate)
            System.err.println("No layer definition file: " + layerPathFile.getPath() + (layerPathFile.isAbsolute() ? "" : " (at full path " + layerPathFile.getAbsolutePath() + ")") + " in layer path: " + layerPath);
      }
      else if (layer.initFailed && lpi.activate) {
         System.err.println("Layer: " + layer.getLayerName() + " failed to start");
         anyErrors = true;
         return null;
      }
      return layer;
   }
/**
    * The layer lookup is first done with the complete path name, i.e. sc.util,
    * If we can't find the layer in the sub-directory "sc/util", we then just look
    * for util.  This makes it optional to put the layer's package prefix onto directory
    * tree where the layer lives, avoiding those extra nearly empty directories.
    */
The layer lookup is first done with the complete path name, i.e. sc.util,
If we can't find the layer in the sub-directory "sc/util", we then just look
for util.  This makes it optional to put the layer's package prefix onto directory
tree where the layer lives, avoiding those extra nearly empty directories.
The layer lookup is first done with the complete path name i . e . sc . util If we can ' t find the layer in the sub - directory " sc / util " we then just look for util . This makes it optional to put the layer ' s package prefix onto directory tree where the layer lives avoiding those extra nearly empty directories .
private Layer initLayer(String layerPathName, String relDir, String relPath, boolean markDynamic, LayerParamInfo lpi) {
      String prefix = null;
      String origLayerPathName = layerPathName;
      Layer layer = findLayerInPath(layerPathName, relDir, null, markDynamic, lpi);
      int ix;
      /* TODO: remove this? not sure what it was doing but it can cause weird errors if a layer is not found and some
       * component part of the path matches - e.g. if we are trying to resolve content.html.core it will find html.core
       * and complain that the layer name does not match
      while (layer == null && (ix = layerPathName.indexOf(".")) != -1) {
         prefix = CTypeUtil.prefixPath(prefix, layerPathName.substring(0, ix));
         layerPathName = layerPathName.substring(ix+1);
         layer = findLayerInPath(layerPathName, relDir, prefix, markDynamic, lpi);
         if (layer != null)
            System.out.println("*** Weird case of returning prefixed layer: " + layerPathName + " relDir: " + relDir);
      }
      */
      if (layer == null && relPath != null) {
         layer = findLayerInPath(CTypeUtil.prefixPath(relPath, origLayerPathName), relDir, null, markDynamic, lpi);
      }
      if (layer == null) {
         origLayerPathName = origLayerPathName.replace('.',FileUtil.FILE_SEPARATOR_CHAR);
         String layerBaseName = FileUtil.addExtension(FileUtil.getFileName(origLayerPathName), SCLanguage.STRATACODE_SUFFIX);
         String layerFileName = FileUtil.concat(origLayerPathName, layerBaseName);
         File layerPathFile = new File(layerFileName);
         if (lpi.activate)
            System.err.println("No layer definition file: " + layerPathFile.getPath() + (layerPathFile.isAbsolute() ? "" : " (at full path " + layerPathFile.getAbsolutePath() + ")") + " in layer path: " + layerPath);
      }
      else if (layer.initFailed && lpi.activate) {
         System.err.println("Layer: " + layer.getLayerName() + " failed to start");
         anyErrors = true;
         return null;
      }
      return layer;
   }
private Layer initLayer ( String layerPathName , String relDir , String relPath , boolean markDynamic , LayerParamInfo lpi ) { String prefix = null ; String origLayerPathName = layerPathName ; Layer layer = findLayerInPath ( layerPathName , relDir , null , markDynamic , lpi ) ; int ix ; /* TODO: remove this? not sure what it was doing but it can cause weird errors if a layer is not found and some
       * component part of the path matches - e.g. if we are trying to resolve content.html.core it will find html.core
       * and complain that the layer name does not match
      while (layer == null && (ix = layerPathName.indexOf(".")) != -1) {
         prefix = CTypeUtil.prefixPath(prefix, layerPathName.substring(0, ix));
         layerPathName = layerPathName.substring(ix+1);
         layer = findLayerInPath(layerPathName, relDir, prefix, markDynamic, lpi);
         if (layer != null)
            System.out.println("*** Weird case of returning prefixed layer: " + layerPathName + " relDir: " + relDir);
      }
      */ if ( layer == null && relPath != null ) { layer = findLayerInPath ( CTypeUtil . prefixPath ( relPath , origLayerPathName ) , relDir , null , markDynamic , lpi ) ; } if ( layer == null ) { origLayerPathName = origLayerPathName . replace ( '.' , FileUtil . FILE_SEPARATOR_CHAR ) ; String layerBaseName = FileUtil . addExtension ( FileUtil . getFileName ( origLayerPathName ) , SCLanguage . STRATACODE_SUFFIX ) ; String layerFileName = FileUtil . concat ( origLayerPathName , layerBaseName ) ; File layerPathFile = new File ( layerFileName ) ; if ( lpi . activate ) System . err . println ( "No layer definition file: " + layerPathFile . getPath ( ) + ( layerPathFile . isAbsolute ( ) ? "" : " (at full path " + layerPathFile . getAbsolutePath ( ) + ")" ) + " in layer path: " + layerPath ) ; } else if ( layer . initFailed && lpi . activate ) { System . err . println ( "Layer: " + layer . getLayerName ( ) + " failed to start" ) ; anyErrors = true ; return null ; } return layer ; }
The layer lookup is first done with the complete path name, i.e.
The layer lookup is first done with the complete path name i . e .
// relPath NOT propagated here