Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/vm/TruffleVM.java @ 21478:2dad34a3d7b0
Hardcoding .sl mimetype for now. Should have an API so language implementations can declare their own supported mime types.
author | Jaroslav Tulach <jaroslav.tulach@oracle.com> |
---|---|
date | Mon, 25 May 2015 08:49:16 +0200 |
parents | 99942eac9c6d |
children | bb51b9a142b3 |
comparison
equal
deleted
inserted
replaced
21477:b1e712f66fe0 | 21478:2dad34a3d7b0 |
---|---|
145 Source s; | 145 Source s; |
146 String mimeType; | 146 String mimeType; |
147 if (location.getScheme().equals("file")) { | 147 if (location.getScheme().equals("file")) { |
148 File file = new File(location); | 148 File file = new File(location); |
149 s = Source.fromFileName(file.getPath(), true); | 149 s = Source.fromFileName(file.getPath(), true); |
150 mimeType = file.getName().endsWith(".c") ? "text/x-c" : Files.probeContentType(file.toPath()); | 150 if (file.getName().endsWith(".c")) { |
151 mimeType = "text/x-c"; | |
152 } else if (file.getName().endsWith(".sl")) { | |
153 mimeType = "application/x-sl"; | |
154 } else { | |
155 mimeType = Files.probeContentType(file.toPath()); | |
156 } | |
151 } else { | 157 } else { |
152 URL url = location.toURL(); | 158 URL url = location.toURL(); |
153 s = Source.fromURL(url, location.toString()); | 159 s = Source.fromURL(url, location.toString()); |
154 URLConnection conn = url.openConnection(); | 160 URLConnection conn = url.openConnection(); |
155 mimeType = conn.getContentType(); | 161 mimeType = conn.getContentType(); |