Fixing GNOME to recognise MATLAB source files

Matlab / Octave programming forum.

Fixing GNOME to recognise MATLAB source files

Postby QuantumKnot on February 17th, 2008, 3:33 pm

GNOME uses mimetypes to recognise filetypes. You can check the type of file by issuing the following command:

Code: Select all
gnomevfs-info file


For MATLAB files, which end with a *.m, GNOME will mistakingly think this is an objective-c source file. Consequently, it will refuse to open it in gedit. Why? Because GNOME is also smart enough to read the contents of the file and determine it to be a MATLAB file. Given the discrepancy, it prints out a warning saying there is a security problem.

Image

To fix this problem, login as root and go to /usr/share/mime/packages and modify the file 'freedesktop.org.xml'

In that file you will see the objective-c mimetype, which comes before the matlab one.

Code: Select all
  <mime-type type="text/x-objcsrc">
    <sub-class-of type="text/x-csrc"/>
    <comment>Objective-C source code</comment>
    <comment xml:lang="bg">Изходен код на Objective C</comment>
    <comment xml:lang="ca">codi font en Objective-C</comment>
    <comment xml:lang="cs">Zdrojový kód v Objective-C</comment>
    <comment xml:lang="da">Objektiv C-kildekode</comment>
    <comment xml:lang="de">Objective-C-Quelltext</comment>
    <comment xml:lang="el">πηγαίος κώδικας Objective-C</comment>
    <comment xml:lang="eo">fontkodo en Objective-C</comment>
    <comment xml:lang="es">código fuente en Objective-C</comment>
    <comment xml:lang="eu">Objective-C iturburu-kodea</comment>
    <comment xml:lang="fi">Objective-C-lähdekoodi</comment>
    <comment xml:lang="fr">code source Objective-C</comment>
    <comment xml:lang="hu">Objective-C forráskód</comment>
    <comment xml:lang="it">Codice sorgente Objective-C</comment>
    <comment xml:lang="ja">Objective-C ソースコード</comment>
    <comment xml:lang="ko">Objective-C 소스 코드</comment>
    <comment xml:lang="lt">Objective-C pradinis kodas</comment>
    <comment xml:lang="ms">Kod sumber Objective-C</comment>
    <comment xml:lang="nb">Objective-C-kildekode</comment>
    <comment xml:lang="nl">Objective-C-broncode</comment>
    <comment xml:lang="nn">Objective-C-kjeldekode</comment>
    <comment xml:lang="pl">Kod źródłowy w Obiektowym C</comment>
    <comment xml:lang="pt">código fonte Objective-C</comment>
    <comment xml:lang="pt_BR">Código fonte Objective-C</comment>
    <comment xml:lang="ru">исходный код Objective-C </comment>
    <comment xml:lang="sq">Kod burues C objekt</comment>
    <comment xml:lang="sr">Објектни-C изворни ко̂д</comment>
    <comment xml:lang="sv">Objective-C-källkod</comment>
    <comment xml:lang="uk">Вихідний код на мові Objective-C</comment>
    <comment xml:lang="vi">Mã nguồn Objective-C</comment>
    <comment xml:lang="zh_CN">Objective-C 源代码</comment>
    <comment xml:lang="zh_TW">Objective-C 源代碼</comment>
    <magic priority="30">
      <match value="#import" type="string" offset="0"/>
    </magic>
    <glob pattern="*.m"/>
  </mime-type>


All you have to do it swap them so that matlab comes first.

Then run the command:

Code: Select all
update-mime-database /usr/share/mime


Logout of GNOME and the problem should be fixed :)
Image
User avatar
QuantumKnot
Linux Adept
 
Posts: 101
Joined: January 21st, 2008, 11:58 am

Return to Matlab

Who is online

Users browsing this forum: No registered users and 0 guests

cron

dsplabs homelinux bloglinux forums new!travel photography
©2012 dsplabs.com.au