Bug 235457 - Weird handling of .directory files
Summary: Weird handling of .directory files
Alias: None
Product: kio
Classification: Unclassified
Component: general (show other bugs)
Version: 4.13.2
Platform: Chakra Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: David Faure
: 194253 (view as bug list)
Depends on:
Reported: 2010-04-26 17:36 UTC by Malte S. Stretz
Modified: 2018-04-24 21:40 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:

Screenshot showing a non-existent green directory and the error message. (62.54 KB, image/png)
2010-08-28 15:28 UTC, Malte S. Stretz
dot-directory file (138 bytes, text/plain)
2010-08-28 18:57 UTC, Malte S. Stretz

Note You need to log in before you can comment on or make changes to this bug.
Description Malte S. Stretz 2010-04-26 17:36:12 UTC
Version:           1.4 (using 4.4.2 (KDE 4.4.2), Kubuntu packages)
Compiler:          cc
OS:                Linux (x86_64) release 2.6.32-21-generic

When you change the icon of a folder and switch on hidden files in that directory, the handling of the created .directory file is odd:  Instead of a general icon, the Icon referenced from the file is displayed so it looks like you've actually got another hidden directory (if you chose an Icon resembling a folder).

Even worse:  If you click on that file, it isn't opened with KWrite or something, but instead you get the error 'The desktop entry file /path/to/.directory has no Type=... entry.'

So it looks like I've got a hidden directory which I can't open and if I didn't know what a 'desktop entry file' is and what these hidden files are used for, I guess I'd feel even more like WTF?
Comment 1 Peter Penz 2010-08-17 11:44:08 UTC
Thanks for the report, but I cannot reproduce this issue with KDE SC 4.5.0. Please reopen the report, if it still occurs in your environment.
Comment 2 Malte S. Stretz 2010-08-28 15:27:59 UTC
Nope, this is still present in KDE 4.5.0.  I'll attach a screenshot to show what I mean.

Qt: 4.7.0
KDE Development Platform: 4.5.00 (KDE 4.5.0)
Dolphin: 1.5
Comment 3 Malte S. Stretz 2010-08-28 15:28:48 UTC
Created attachment 51054 [details]
Screenshot showing a non-existent green directory and the error message.
Comment 4 Peter Penz 2010-08-28 18:50:04 UTC
Strange... Would it be possible that you provide step-by-step instructions how to reproduce this issue? I changed the icon of a folder and switched on hidden files in that directory, but cannot reproduce this issue.
Comment 5 Malte S. Stretz 2010-08-28 18:57:34 UTC
Created attachment 51061 [details]
dot-directory file

Of course.  I also attached the generated .directory file.

1. Go to ~
2. Select File->Create New->Folder
3. Name it Test or whatever you like
4. Change into that (empty) folder
5. Enable View->Show Hidden Files (the .directory file is created)
6. Disable View->Preview
7. Right-Click into the white empty folder space, chose Properties
8. Click the icon to change the folders icon
9. Watch how the .directory file changes its icon, too
10. Click on that file and enjoy the error message :)
Comment 6 Malte S. Stretz 2010-08-28 19:02:09 UTC
I also went into the File Associations KCM to find out what the default command for this should be.  According to the properties is this a "desktop configuration file".  When I type that into the search field, all I get with that description is application/x-desktop.

But that MIME type has only the extensions *.desktop and *.kdelnk associated.  And the Application Preference order is Kate, KWrite, OpenOffice.org Word Processor (WTF?).

Dunno whats going on here.
Comment 7 Jekyll Wu 2012-01-08 00:37:07 UTC
Should bug 194253 be merged into this report?
Comment 8 Jeroen van Meeuwen (Kolab Systems) 2012-08-24 16:19:55 UTC
Resetting assignee to default as per bug #305719
Comment 9 Maarten De Meyer 2013-05-07 23:03:26 UTC
*** Bug 194253 has been marked as a duplicate of this bug. ***
Comment 10 Maarten De Meyer 2013-05-07 23:07:10 UTC
This is because dolphin doesn't create valid a desktop entry.
Every .directory file should have a Type= and a Name= key.


Looks like the code is in viewproperties.cpp if somebody wants to try.
Comment 11 Frank Reininghaus 2014-08-16 08:23:16 UTC
Thanks Maarten for the information, and sorry for the late response. According to the specification, the valid values for the "Type" are Application, Link and Directory. If I add a "Type=..." line to the "[Desktop Entry]" group, I can never achieve that clicking the file results in opening it in KWrite, no matter if there is a "Name=..." line or not (tested with KDE SC 4.13.3 - note that no source code modification is needed at all for testing this because one can simply edit the .directory file in a text editor):

For the type "Directory", I get an error message "The desktop entry of type Directory is unknown".

For the type "Link", I get "The desktop entry file ... is of type Link but has no URL=... entry.".

For the type "Application", nothing happens when clicking the .directory file.

So I don't see what we can do about this problem, sorry about that.

Note that the [Desktop Entry] group in the .directory file is actually not created by Dolphin at all. This is done by the Properties dialog, which is part of kdelibs. Without this group, the .directory file is just a regular text file, which can be opened just fine by clicking it.

So I am not sure what to do with this report. Unless anyone has a good idea, we should probably reassign it to KIO (which could just treat the file as a text file instead of showing the error messages) or close it as WONTFIX (since we do not have a CANTFIX state).
Comment 12 Frank Reininghaus 2014-08-20 06:58:21 UTC
I'll reassign to KIO, where the error dialogs probably come from. I don't see anything we can do in Dolphin itself to fix this problem.
Comment 13 Maarten De Meyer 2014-08-20 17:38:05 UTC
Thank you for looking into this.
I have patch for kio that I'll post soon. With my patch kio is able to handle .directory files as expected.

The only remaining issue is that it has the same icon as the parent folder. I have not looked into solving that.
Comment 14 Maarten De Meyer 2014-08-22 15:48:33 UTC
Git commit 76eeb6a21c7553d65e02366837c742c1c91d295b by Maarten De Meyer.
Committed on 21/08/2014 at 13:02.
Pushed by demeyer into branch 'master'.

Open .directory files as plain text.

We cannot execute .directory files so we have to trick KRun in opening
them as plain text.
REVIEW: 119869

M  +5    -0    src/widgets/kdesktopfileactions.cpp

Comment 15 Nate Graham 2018-04-24 21:40:04 UTC
Can't reproduce any of the issues described in the original ticket with KDE Frameworks 5.45 and Dolphin 18.04.