LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 01-05-2005, 03:15 PM   #1
vdemuth
Member
 
Registered: Oct 2003
Location: West Midlands, UK
Distribution: Slackware 14 (Server),Suse 13.1 (Desktop),, Mepis on the wifes lappy
Posts: 768

Rep: Reputation: 92
How does KDE determine file type?


Hi all,
Here is my problem.
I run KDE as my Desktop Env. Now no flame wars please, I just happen to prefer it, but I have just noticed a very strange thing and hope someone can answer it for me.
When using Konqueror to browse my files, and more specifically, my config files in my /ETC directory, I have some files which when I hover my mouse over them, shows in the popup window to be PLAIN TEXT files. while others show up as DIFF files, even though they are both files with the extension .conf.
If I rename the file that shows as a DIFF file by changing itīs extension to be, for example, .txt, then the mouseover shows it to be a PLAIN TEXT file, but if I then rename it back again, it reverts to a DIFF file.
I even have some files that though they have an extension of .conf, show up as C++ files.
Now this is not really a great problem, but purely to fill my curiosity, and to allow me to learn even more about Linux, does anyone have any idea why this happens, and how to tell what file type is what, NOT based on itīs extension.

TIA
 
Old 01-05-2005, 04:06 PM   #2
__J
Senior Member
 
Registered: Dec 2004
Distribution: Slackware, ROCK
Posts: 1,973

Rep: Reputation: 46
open a console and type:

file --help

it is a program to determine the type of files.
 
Old 01-05-2005, 05:11 PM   #3
wapcaplet
Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
My guess is that KDE uses a combination of file extension and use of the 'file' utility mentioned by __J (or something similar) in order to determine file type. If renaming the file extension had an effect on KDE's assessment of what kind of file it is, then clearly it's making some suppositions based on that. The 'file' utility tries to identify files by contents, rather than extension. It's very often accurate. However, I can see where guessing based on extension would be useful, too; you may have a text file (with a .txt extension, to remind yourself what kind of file it is) that contains part of a diff. You want the file to be treated as plain text, rather than viewed in a diff-viewer of some kind. Plain text files can include many different types of data; 'file' tries to distinguish different types.

But actually, I have no idea what method KDE uses to determine file type.
 
Old 01-06-2005, 12:00 PM   #4
vdemuth
Member
 
Registered: Oct 2003
Location: West Midlands, UK
Distribution: Slackware 14 (Server),Suse 13.1 (Desktop),, Mepis on the wifes lappy
Posts: 768

Original Poster
Rep: Reputation: 92
OK,
Have done as suggested, and the command:- file -modules.conf returns this----modules.conf: ASCII text.
But, in KDE konqueror, it shows as a Diff file. Is this then a bug in Konqueror/KDE, or is there some more obvious reason that I donīt know about?

Have done a little more digging, and it seems that KDE determines file type from the Mime type, so I can only conclude that something in KDE is broken. Any idea where to find the right configuration file for KDE mime types registration?

Last edited by vdemuth; 01-06-2005 at 12:27 PM.
 
Old 01-08-2005, 05:08 AM   #5
vdemuth
Member
 
Registered: Oct 2003
Location: West Midlands, UK
Distribution: Slackware 14 (Server),Suse 13.1 (Desktop),, Mepis on the wifes lappy
Posts: 768

Original Poster
Rep: Reputation: 92
More info,
I have looked at these files using XFM, and they show as plain text files as I would expect. Also using XFCE, TWM, FLUXBOX etc they show as plain text files, which would siggest that this is a problem with KDE and/or Konqueror.
Anyone else any suggestions
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to determine partition type? halturata Linux - General 2 08-11-2005 03:07 PM
How to determine partition type? halturata Linux - General 3 08-11-2005 04:11 AM
How do I determine file system type? lowpro2k3 Linux - General 5 07-09-2005 04:40 PM
determine type of device for USB devices lyar1031 Linux - Newbie 2 07-29-2004 09:02 PM
how do i determine my file system? Pete Dogg Linux - Software 3 10-16-2003 04:56 PM


All times are GMT -5. The time now is 07:43 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration