# HG changeset patch # User Jaroslav Tulach # Date 1443611362 -7200 # Node ID dcee887614b1aa57c2c11fdd175cfd975c8f1cb1 # Parent df57bc2fcdbdf315faf63dd4cf5e97fd3e08f70a Removing hardcoded MIME types in the source. Each language is supposed to register its own FileTypeDetector as SL did in cf19259edf87. diff -r df57bc2fcdbd -r dcee887614b1 truffle/com.oracle.truffle.api.vm/src/com/oracle/truffle/api/vm/PolyglotEngine.java --- a/truffle/com.oracle.truffle.api.vm/src/com/oracle/truffle/api/vm/PolyglotEngine.java Wed Sep 30 12:38:35 2015 +0200 +++ b/truffle/com.oracle.truffle.api.vm/src/com/oracle/truffle/api/vm/PolyglotEngine.java Wed Sep 30 13:09:22 2015 +0200 @@ -381,15 +381,7 @@ if (location.getScheme().equals("file")) { File file = new File(location); s = Source.fromFileName(file.getPath(), true); - if (file.getName().endsWith(".c")) { - mimeType = "text/x-c"; - } else if (file.getName().endsWith(".sl")) { - mimeType = "application/x-sl"; - } else if (file.getName().endsWith(".R") || file.getName().endsWith(".r")) { - mimeType = "application/x-r"; - } else { - mimeType = Files.probeContentType(file.toPath()); - } + mimeType = Files.probeContentType(file.toPath()); } else { URL url = location.toURL(); s = Source.fromURL(url, location.toString()); diff -r df57bc2fcdbd -r dcee887614b1 truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/source/Source.java --- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/source/Source.java Wed Sep 30 12:38:35 2015 +0200 +++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/source/Source.java Wed Sep 30 13:09:22 2015 +0200 @@ -905,16 +905,10 @@ @Override String findMimeType() { - if (file.getName().endsWith(".c")) { - return "text/x-c"; - } else if (file.getName().endsWith(".R") || file.getName().endsWith(".r")) { - return "application/x-r"; - } else { - try { - return Files.probeContentType(file.toPath()); - } catch (IOException ex) { - LOG.log(Level.SEVERE, null, ex); - } + try { + return Files.probeContentType(file.toPath()); + } catch (IOException ex) { + LOG.log(Level.SEVERE, null, ex); } return null; } @@ -993,16 +987,10 @@ @Override String findMimeType() { - if (file.getName().endsWith(".c")) { - return "text/x-c"; - } else if (file.getName().endsWith(".R") || file.getName().endsWith(".r")) { - return "application/x-r"; - } else { - try { - return Files.probeContentType(file.toPath()); - } catch (IOException ex) { - LOG.log(Level.SEVERE, null, ex); - } + try { + return Files.probeContentType(file.toPath()); + } catch (IOException ex) { + LOG.log(Level.SEVERE, null, ex); } return null; }