Add .lyp externsion to layer properties files by default ?

edited October 2012 in General
Hi,
I guess it is not the case on most platforms, but on Ubuntu the ".lyp" extension is not added to the file name when I use File>Save Layer Properties.
As a result if I try to load it right after, the file is not displayed by default (due to the filter showing only layer properties files).
Is it normal ?
Cheers
PS : the tip in this discussion is actually very useful !
http://klayout.de/forum/comments.php?DiscussionID=102&page=1#Item_0

Comments

  • edited November -1

    Hallo,

    you're right, the extension is not added automatically.

    I am using the standard Qt file dialogs and I guess this is a specific behaviour of the Gtk style dialog embedded into Qt. I just verified with another Ubuntu application (Document Viewer) that this is also the case for that - when a save a PDF file it does not get the .pdf extension unless I add it.

    The strange thing however is, that the Document Viewer application is able to detect that the file is a PDF document even if the extension is not .pdf. I don't know how I can achieve that in Qt. I have to do some research on that topic before I can tell more about it.

    Thanks and regards,

    Matthias

  • edited November -1

    Hallo,

    I did some research on that topic but I am not much wiser than before. Apparently it's the choice of GTK (the toolkit behind GNOME) not to alter the filename, even if no suffix is given. Apparently the idea of GTK to determine the file type by content sniffing if there is no suffix given. This is achieved through a set of "magic" rules linking a search pattern in the file with a file type. Such rules can be defined in the MIME type database, which is an integral part of the GNOME desktop. Hence the file extension is not of particular importance for GTK and the file dialog simply will take the file as it is. A well-behaving GTK application will probably register magic rules for the file types they support and offer file type filters based on content rather than extension.

    Unfortunately Qt is not well behaving in that respect and does not support MIME type filtering based on content. Instead the file type filter is purely based on the extension. There is no simple solution for that - I have to work around that issue in my code somehow.

    Regards,

    Matthias

Sign In or Register to comment.