Mercurial Hosting > luan
comparison 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 |
comparison
equal
deleted
inserted
replaced
218:92f5d74697f8 | 219:f9e3e64132e1 |
---|---|
72 return null; | 72 return null; |
73 if( path.startsWith("java:") ) { | 73 if( path.startsWith("java:") ) { |
74 path = path.substring(5); | 74 path = path.substring(5); |
75 if( path.contains("//") ) | 75 if( path.contains("//") ) |
76 return null; | 76 return null; |
77 URL url = ClassLoader.getSystemResource(path); | 77 URL url; |
78 if( url==null && path.endsWith("/") ) { | 78 if( !path.contains("#") ) { |
79 url = ClassLoader.getSystemResource(path+"index.html"); | 79 url = ClassLoader.getSystemResource(path); |
80 if( url==null ) | 80 } else { |
81 url = ClassLoader.getSystemResource(path+"index.html.luan"); | 81 String[] a = path.split("#"); |
82 if( url != null ) { | 82 url = ClassLoader.getSystemResource(a[0]); |
83 try { | 83 if( url==null ) { |
84 url = new URL(url,"."); | 84 for( int i=1; i<a.length; i++ ) { |
85 } catch(MalformedURLException e) { | 85 url = ClassLoader.getSystemResource(a[0]+"/"+a[i]); |
86 throw new RuntimeException(e); | 86 if( url != null ) { |
87 try { | |
88 url = new URL(url,"."); | |
89 } catch(MalformedURLException e) { | |
90 throw new RuntimeException(e); | |
91 } | |
92 break; | |
93 } | |
87 } | 94 } |
88 } | 95 } |
89 } | 96 } |
90 return url==null ? null : url; | 97 return url==null ? null : url; |
91 } | 98 } |