Announcement

Collapse
No announcement yet.

[SOLVED] Question regarding file associations

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] Question regarding file associations

    Can anyone please explain me how do file associations work in KDE?
    Basically I see all my associations in System Settings -> File Associations; it's possible to edit them and changes make effect.
    But, for example, there's list of applications associated with .bat (Windows batch) files - I can see them in context menu (they're same as for .txt files). I don't see them in System Settings however. Moreover, I created new file type with *.bat wildcard and added wine as the default application - with no effect. It doesn't show in context menu and doesn't change the default (double-click) behavior.
    How to change association for this type of file? Any help would be appreciated.

    #2
    Re: Question regarding file associations

    I could be a bit off base here but here's my best answer:

    File associations, like many things, are different with linux than with windows.

    Windows relies on a file extension to determine what type a file may be and what program to apply to it. Linux does not care what a file's name is.

    Linux attempts to determine what type a file (and what to do with it) is by it's initial bits of data.

    I've actually never used the "File Extensions" in system settings to change KDE's action for a particular file. Rather, I right click on the file icon, select "Properties" from the menu, then click on the little wrench icon to the far right of the file type listing in the Properties window, and this opens a window with "Application Preference Order" in it and a list of applicable programs and the order in which you wish them to take effect.

    The net results of this is when you click on a file icon, the default (first in the list) application acts on the file, if you right-click on the same icon, you'll get a menu which has the list of all the programs currently associated with this filetype under the "Open with..." option.

    An example would be a .jpg file. The default program might be a simple viewer like Gwenview, and the optional programs might be GIMP and digiKam...

    Please Read Me

    Comment


      #3
      Re: Question regarding file associations

      Thank you for your answer, oshunluvr!
      Now it became a bit clearer, but still I'm confused. If extensions are completely irrelevant for associations, then what is "File Associations" part in "System Settings" for? Associations are managed solely by extensions there, and for most file types they seem to work.
      Still I don't know how to set association for .bat files. According to their contents they're text files, but I need different association for them.

      Comment


        #4
        Re: Question regarding file associations

        To be honest - I have no idea what that setting does in System Settings as I've never even looked at it. It appears to be where one would define a file type, but I've never run across a file type that I needed to manually prepare for. Remember, linux still uses and understands file types, it just doesn't require a dot-three-letter extension to figure out what a file is. As far as your .bat files, they are in fact text files. After looking into the File Associations a little bit I see there is a place to add a "filename pattern" but I believe most types are recognized with or without an extension. It would aid the system to determine what to do with a certain type of text file for example.

        Since only windows uses .bat type script files, you would need to add wine as a program to act on them in the manner I described above, not only in the File Associations. Assuming of course, that's what you're trying to do - you haven't really explained what your goal is with these files. You're running batch files to effect a windows program you're running under wine? You might need to create a desktop file and add a command to it to run a windows text file this way. The command might look something like "wine blah.bat".

        I found this post http://ubuntuforums.org/showthread.php?t=630802

        Linux uses various script files in a different way - you flag the file as executable and then it will run as a script.

        Please Read Me

        Comment


          #5
          Re: Question regarding file associations

          Finally I managed to solve this problem, though it all seems very strange.
          It appeared at some moment that association with wine (that was my goal) was working for all .bat files except the one that I tested it on! Perhaps KDE had cached associations for this particular file and didn't try to reread configuration. I renamed this file and everything worked well: it was executed in wine.
          And there's one more strange thing: wine executes the file only if I make it run in terminal (checkbox in Advanced Options of association). If it's configured to run silently it just doesn't run at all (and I can't find out why since there's no terminal output).

          Comment


            #6
            Re: [SOLVED] Question regarding file associations

            Wine is kind of a shell so it might behave differently than you would expect a regular command line entry to work.

            You could try opening a terminal, cut and pasting a command from your icon entry, and seeing some output there - maybe

            Please Read Me

            Comment

            Working...
            X