All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.snapscript.studio.agent.debug.ResourceExtractor Maven / Gradle / Ivy

There is a newer version: 1.4.6
Show newest version
package org.snapscript.studio.agent.debug;

public class ResourceExtractor {
   
   private static final String SOURCE_SUFFIX = ".snap";

   public static String extractModule(String path) {
      int length = path.length();
      
      if(path.endsWith(SOURCE_SUFFIX)) {
         path = path.substring(0, length - 5);
      }
      if(path.startsWith("/")) {
         path = path.substring(1);
      }
      return path.replace('/', '.');
   }
   
   public static String extractResource(String module) {
      String path = module;
      
      if(!path.startsWith("/")) {
         path = "/" + path;
      }
      if(!path.endsWith(SOURCE_SUFFIX)) {
         path = path.replace('.', '/');
         path = path + SOURCE_SUFFIX;
      }
      return path;
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy