You are not logged in.

#1 2023-08-29 11:28:47

archuser11
Member
Registered: 2023-08-29
Posts: 1

Does anyone have a Treemagic - treematch working example? MIME

Hi Guys,

Admittedly I'm not on Arch - but I often look at Arch forums or wiki pages as they are often very informative and well written, so I'm hoping someone can help me with this one,  this is a MIME, freedesktop question.

I would like to use treematch in my package definition to classify files in a folder differently from others?
(If someone would have a working example that may already help)

The idea is to have a package.xml file identifying one filetype  normally, say through a glob-match on the global system  and then copy/rename that package.xml file, change tye filetype to  minder2 and add a treemagic path to it, to identify  files in that particular path differently.

Example: have a glob match *.minder with mimetype  "minder" in file 1 and glob-match *.minder + treeematch "testfolder"  with mimetype minder2 in file 2.


Result:
*.minder = "minder" file-type on the system
*.minder in a certain directory = "minder2" file-type


But I can't get the treemagic thing working:

I've read the xdg specifications/instructions on the freedesktop site https://specifications.freedesktop.org/ … -0.21.html

1)
a) Created a folder: /home/bggf/TestFolderTreemagic
b) Put some text into a file called "treematch" without extension with echo -> echo "asdf" > treematch

2)
created a package file which I installed with update-mime-database:

<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
  <mime-type type="application/DifferentIconTheme">
    <comment>Mytext file at DifferentIconTheme </comment>
    <icon name="feh"/>
        <treemagic priority="80">
     <treematch path="/home/bggf/TestFolderTreemagic" type="directory" non-empty="true" />
    </treemagic>
  </mime-type>
</mime-info>

3) updated the mime database with update-mime-database

Result:  I do get a treemagic file in the .local/share/mime directory:

cat treemagic
MIME-TreeMagic
[80:application/DifferentIconTheme]
>"/home/bggf/TestFolderTreemagic"=directory,non-empty

But it never seems to match, I tried:
type=file: the exact filename;  path with and without starting "/" (the documentation says it is relative to "/"); no parameters other than the path

The result, with both the "mimetype" command and gio is always a text file type:

gio info --attributes=standard::content-type /home/bggf/TestFolderTreemagic/treematch
uri: file:///home/bggf/TestFolderTreemagic/treematch
local path: /home/bggf/TestFolderTreemagic/treematch
unix mount: /dev/sda1 / ext4 rw,relatime,errors=remount-ro
attributes:
  standard::content-type: text/plain


So my question is:
1) Is it possible to select a group of files in a directory with treemagic? is this search pattern there to do something else?
2) Has anyone a working example? I've found only one treemagic example file on the internet with ".kobo" in there, but even trying this example on my system didn't work.
3) Is the problem that this treemagic match won't be invoked?
I purposefully didn't create an extension on my test file or put any glob matches for my test. (although a new made-up extension did not change things either...always a text file).


Environment:
OS: Debian (admittedly...but perhaps someone can help, it is a freedesktop related question)
DE: xfce4

Thanks in advance for any help

Offline

Board footer

Powered by FluxBB