Skip to content

Commit

Permalink
fallback to system/shell for unknown filetypes in desktop mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Jul 3, 2011
1 parent d503f9e commit b84be4a
Showing 1 changed file with 8 additions and 4 deletions.
Expand Up @@ -16,6 +16,7 @@
import com.google.inject.Inject;
import com.google.inject.Singleton;
import org.rstudio.core.client.files.FileSystemItem;
import org.rstudio.studio.client.application.Desktop;
import org.rstudio.studio.client.application.events.EventBus;
import org.rstudio.studio.client.common.reditor.EditorLanguage;

Expand Down Expand Up @@ -167,10 +168,13 @@ public FileType getTypeForFile(FileSystemItem file, boolean canUseDefault)
return result;

// last ditch -- see if this either a known text file type
// or NOT a known binary type. the result of this is that
// unknown files types are treated as text and opened in
// the editor
String mimeType = file.mimeType();
// or (for server mode) NOT a known binary type. the result of
// this is that unknown files types are treated as text and
// opened in the editor (we don't do this on desktop because
// in that case users have the recourse of using a local editor)
String defaultType = Desktop.isDesktop() ? "application/octet-stream" :
"text/plain";
String mimeType = file.mimeType(defaultType);
if (mimeType.startsWith("text/"))
return TEXT;
}
Expand Down

0 comments on commit b84be4a

Please sign in to comment.