LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 02:15 PM   #1
vdemuth
Member
 
Registered: Oct 2003
Location: West Midlands, UK
Distribution: Slackware 14 (Server),OpenSuse 13.2 (Laptop & Desktop),, OpenSuse 13.2 on the wifes lappy
Posts: 781

Rep: Reputation: 98
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, 03: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, 04:11 PM   #3
wapcaplet
LQ 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, 11:00 AM   #4
vdemuth
Member
 
Registered: Oct 2003
Location: West Midlands, UK
Distribution: Slackware 14 (Server),OpenSuse 13.2 (Laptop & Desktop),, OpenSuse 13.2 on the wifes lappy
Posts: 781

Original Poster
Rep: Reputation: 98
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 11:27 AM.
 
Old 01-08-2005, 04:08 AM   #5
vdemuth
Member
 
Registered: Oct 2003
Location: West Midlands, UK
Distribution: Slackware 14 (Server),OpenSuse 13.2 (Laptop & Desktop),, OpenSuse 13.2 on the wifes lappy
Posts: 781

Original Poster
Rep: Reputation: 98
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



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 02:07 PM
How to determine partition type? halturata Linux - General 3 08-11-2005 03:11 AM
How do I determine file system type? lowpro2k3 Linux - General 5 07-09-2005 03:40 PM
determine type of device for USB devices lyar1031 Linux - Newbie 2 07-29-2004 08:02 PM
how do i determine my file system? Pete Dogg Linux - Software 3 10-16-2003 03:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:15 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration