4

Standard UNIX tools (file command) return text/x-c++. This is not the greatest result possible.

On Windows urlmon.dll/FindMimeFromData returns text/plain. Looks like Windows never got any decent file type recognition library.

Is there something more precise than text/plain?

SandRock
  • 5,276
  • 3
  • 30
  • 49
  • Possible duplicate of [What are the MIME types for .NET project source code files?](https://stackoverflow.com/questions/208056/what-are-the-mime-types-for-net-project-source-code-files) – Kevin R. Aug 08 '17 at 20:27
  • I'm reading [here](https://stackoverflow.com/a/208060/282105) and [there](https://stackoverflow.com/a/17619050/282105) the "text/x-csharp" value is sometimes used but can't get a valid source for it. – SandRock Apr 02 '21 at 10:28

1 Answers1

0

I was looking for the same thing on Ubuntu 20.04 - open .CS files in Code and other text files in the default editor.

I copied the line form the /usr/share/applications/defaults.list

text/plain=org.gnome.gedit.desktop

and added the .cs extension like so

text/plain.cs=code

Now my CS files open in VS Code and all other plain text files open in the default editor