diff core/src/luan/modules/Utils.java @ 219:f9e3e64132e1

improve rev 217, allow "java:" paths to include sample files to check in jars git-svn-id: https://luan-java.googlecode.com/svn/trunk@220 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Wed, 16 Jul 2014 04:53:01 +0000
parents a1b142f9c5c0
children 97d175772fed
line wrap: on
line diff
--- a/core/src/luan/modules/Utils.java	Tue Jul 15 20:19:36 2014 +0000
+++ b/core/src/luan/modules/Utils.java	Wed Jul 16 04:53:01 2014 +0000
@@ -74,16 +74,23 @@
 			path = path.substring(5);
 			if( path.contains("//") )
 				return null;
-			URL url = ClassLoader.getSystemResource(path);
-			if( url==null && path.endsWith("/") ) {
-				url = ClassLoader.getSystemResource(path+"index.html");
-				if( url==null )
-					url = ClassLoader.getSystemResource(path+"index.html.luan");
-				if( url != null ) {
-					try {
-						url = new URL(url,".");
-					} catch(MalformedURLException e) {
-						throw new RuntimeException(e);
+			URL url;
+			if( !path.contains("#") ) {
+				url = ClassLoader.getSystemResource(path);
+			} else {
+				String[] a = path.split("#");
+				url = ClassLoader.getSystemResource(a[0]);
+				if( url==null ) {
+					for( int i=1; i<a.length; i++ ) {
+						url = ClassLoader.getSystemResource(a[0]+"/"+a[i]);
+						if( url != null ) {
+							try {
+								url = new URL(url,".");
+							} catch(MalformedURLException e) {
+								throw new RuntimeException(e);
+							}
+							break;
+						}
 					}
 				}
 			}