Results 1 to 10 of 13
Hello,
sorry for the stupid question,
but I have a problem and haven't found any solution to it on this forum so far.
The problem is how to recognize different ...
- 04-25-2007 #1Just Joined!
- Join Date
- Jan 2007
- Location
- Germany
- Posts
- 73
File extension problem under KDE
Hello,
sorry for the stupid question,
but I have a problem and haven't found any solution to it on this forum so far.
The problem is how to recognize different file types under KDE.
I have Mathematica files (with extension .nb and plain text format).
I want them to be opened with Mathematica.
I try to edit them as [Right-click]Properties>Settings>... and choose Filename patterns *.nb *.NB to be declared as Mathematica notebooks and opened with Mathematica. But after this all the plain text files (.txt, .cpp, .h ) are opened with Mathematica. When I declare these (.txt, .cpp, .h ) to be opened with KWrite, Mathematica notebooks are also opened with KWrite.
How is it possible to make KDE aware of the new filetypes ?
Thanks in advance,
Xaleandr
PS: Below are the first few lines of .nb-file if this might help:
Code:(************** Content-type: application/mathematica ************** CreatedBy='Mathematica 5.2' Mathematica-Compatible Notebook
- 05-07-2007 #2Linux Newbie
- Join Date
- Sep 2005
- Location
- CZ
- Posts
- 164
KDE Control center - KDE components (or something similar, I have localised version...) - File associations - select Text - click Add
- 05-08-2007 #3Just Joined!
- Join Date
- Jan 2007
- Location
- Germany
- Posts
- 73
Thanks a lot !!! It works !!!
- 05-09-2007 #4Just Joined!
- Join Date
- Jan 2007
- Location
- Germany
- Posts
- 73
One more question (related to the previous one) :
KDE is able to recognize some file types without any extension.
For example, if You rename files MyFile.zip and MyFile.avi to MyFile1 and MyFile2, KDE will correctly open them with ark and xine.
My question is how to make KDE recognize other files (in particular .nb) without extension.
I found in Google that Konsole reads file information from
/usr/share/misc/file/magic; I found that file contains
so even if I rename MyFile.nb-->MyFile.txt, in Konsole the file is correctly recognized :Code:0 string (*********************** Mathematica 5.0 notebook
My question is how to make KDE also check this file.Code:MyName@MyMachine: ~> file MyFile.txt MyFile.txt: Mathematica, or Pascal, Modula-2 or 3 code text
Thanks in advance,
Xaleandr
- 05-09-2007 #5Linux Newbie
- Join Date
- Sep 2005
- Location
- CZ
- Posts
- 164
An explanation is provided in KDE Help center - User manual - VI. KDE for Administrators - 26. Customizing KDE - File Associations
or here.
The search phrase is "KDE" + "MIME types"
- 05-09-2007 #6Just Joined!
- Join Date
- Jan 2007
- Location
- Germany
- Posts
- 73
Thanks a lot for the prompt reply,
but my question was slightly different. Actually I have seen these pages (similar pages to be exact), my problem is that "magic" file is ignored and KDE somewhy uses "extension-based" files recognition (a la Windows) and I wonder if it is possible to make "contents-based" recognition for custom file types.
For built-in file types, even without any extension, KDE can easily distinguish, e.g. "html" from "postscript" (though both are just plain text files).
Of course I understand that in principle it is possible to use always extensions for the custom file types and not to have this problem. But I wanted to understand in detail if this is possible.
Xaleandr
- 05-09-2007 #7Linux Newbie
- Join Date
- Sep 2005
- Location
- CZ
- Posts
- 164
Well, let's try it step by step along with this old document: did you find the mimelnk directories? Did you find .desktop files there? Did you try to make your own .desktop for Mathematica?
- 05-10-2007 #8Just Joined!
- Join Date
- Jan 2007
- Location
- Germany
- Posts
- 73
Hello,
Yes, I did. The Mathematica.desktop files in mimelnk/text were created automatically when I added filetype "Mathematica" from "Personal settings". As far as I understand these .desktop files are responsible for extension-based filetype recognition, and this works fine, it is Ok.
Have a look at the document You cited in more detail, section about "magic". It is claimed that content-based file recognition in KDE is defined in files
$KDEBASE/share/mimelnk/magic
$HOME/.kde/share/mimelnk/magic
I have these files and have entries for " (****** " pattern inside, but the files are NOT recognised.
I mean, any file will be opened with Mathematica if and only if it has extension .nb or .NB.
Xaleandr
- 05-10-2007 #9Linux Newbie
- Join Date
- Sep 2005
- Location
- CZ
- Posts
- 164
Strange, that should be enough... What is the content of Mathematica.desktop file?
- 05-11-2007 #10Just Joined!
- Join Date
- Jan 2007
- Location
- Germany
- Posts
- 73
File Mathematica.desktop:
Code:[Desktop Entry] Comment=Mathematica Notebook Hidden=false Icon=/usr/local/Wolfram/Mathematica/5.0/SystemFiles/FrontEnd/SystemResources/X/mathematica.xpm MimeType=text/Mathematica Patterns=*.nb;*.NB Type=MimeType


Reply With Quote

