private String scriptFromDisk(String name){
  name=name.replace('\\','/');
  final char SEP=';';
  String pkgPart="";
  String pathPart="";
  String namePart="";
  int at=name.indexOf(SEP);
  if (at > -1) {
    int nextAt=name.indexOf(SEP,at + 1);
    if (nextAt > -1) {
      pathPart=name.substring(0,at);
      pkgPart=name.substring(at + 1,nextAt);
      namePart=name.substring(nextAt + 1);
    }
 else {
      pathPart=name.substring(0,at);
      namePart=name.substring(at + 1);
    }
  }
 else {
    at=name.lastIndexOf('/');
    if (at > -1) {
      int mx=name.lastIndexOf("/mx/");
      if (mx > -1) {
        pathPart=name.substring(0,mx);
        pkgPart=name.substring(mx + 1,at);
      }
 else {
        pathPart=name.substring(0,at);
      }
      namePart=name.substring(at + 1);
    }
 else {
      pathPart=".";
      namePart=name;
    }
  }
  String script=null;
  try {
    Charset realEncoding=null;
    Charset bomEncoding=null;
    InputStream in=locateScriptFile(pathPart,pkgPart,namePart);
    if (in != null) {
      try {
        BufferedInputStream bis=new BufferedInputStream(in);
        bomEncoding=getEncodingFromBOM(bis);
        script=pullInSource(bis,bomEncoding);
        realEncoding=getEncodingFromXMLDirective(script);
      }
  finally {
        try {
          in.close();
        }
 catch (        IOException e) {
        }
      }
    }
    if (realEncoding != null && !realEncoding.equals(bomEncoding)) {
      in=locateScriptFile(pathPart,pkgPart,namePart);
      if (in != null) {
        try {
          BufferedInputStream bis=new BufferedInputStream(in);
          getEncodingFromBOM(bis);
          script=pullInSource(bis,realEncoding);
        }
  finally {
          try {
            in.close();
          }
 catch (          IOException e) {
          }
        }
      }
    }
  }
 catch (  FileNotFoundException fnf) {
    fnf.printStackTrace();
  }
  return script;
}

private String scriptFromDisk ( String name ) { name = name . replace ( '\\' , '/' ) ; final char SEP = ';' ; String pkgPart = "" ; String pathPart = "" ; String namePart = "" ; int at = name . indexOf ( SEP ) ; if ( at > - 1 ) { int nextAt = name . indexOf ( SEP , at + 1 ) ; if ( nextAt > - 1 ) { pathPart = name . substring ( 0 , at ) ; pkgPart = name . substring ( at + 1 , nextAt ) ; namePart = name . substring ( nextAt + 1 ) ; } else { pathPart = name . substring ( 0 , at ) ; namePart = name . substring ( at + 1 ) ; } } else { at = name . lastIndexOf ( '/' ) ; if ( at > - 1 ) { int mx = name . lastIndexOf ( "/mx/" ) ; if ( mx > - 1 ) { pathPart = name . substring ( 0 , mx ) ; pkgPart = name . substring ( mx + 1 , at ) ; } else { pathPart = name . substring ( 0 , at ) ; } namePart = name . substring ( at + 1 ) ; } else { pathPart = "." ; namePart = name ; } } String script = null ; try { Charset realEncoding = null ; Charset bomEncoding = null ; InputStream in = locateScriptFile ( pathPart , pkgPart , namePart ) ; if ( in != null ) { try { BufferedInputStream bis = new BufferedInputStream ( in ) ; bomEncoding = getEncodingFromBOM ( bis ) ; script = pullInSource ( bis , bomEncoding ) ; realEncoding = getEncodingFromXMLDirective ( script ) ; } finally { try { in . close ( ) ; } catch ( IOException e ) { } } } if ( realEncoding != null && ! realEncoding . equals ( bomEncoding ) ) { in = locateScriptFile ( pathPart , pkgPart , namePart ) ; if ( in != null ) { try { BufferedInputStream bis = new BufferedInputStream ( in ) ; getEncodingFromBOM ( bis ) ; script = pullInSource ( bis , realEncoding ) ; } finally { try { in . close ( ) ; } catch ( IOException e ) { } } } } } catch ( FileNotFoundException fnf ) { fnf . printStackTrace ( ) ; } return script ; }
scan the disk looking for the location of where the source resides . may also peel open a swd file looking for the source file .
