diff truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/source/Source.java @ 22209:dcee887614b1

Removing hardcoded MIME types in the source. Each language is supposed to register its own FileTypeDetector as SL did in cf19259edf87.
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Wed, 30 Sep 2015 13:09:22 +0200
parents dc83cc1f94f2
children b56fe0d3b560
line wrap: on
line diff
--- 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;
         }