wrong mime-type displayed for empty text files

Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
I have tried to install a new mime-type for textfiles with a .w extension as follows:
<?xml version="1.0"?>
<!-- In file ~/.local/share/mime/packages/w.xml -->
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="text/w">
<comment>File of w type</comment>
<glob pattern="*.w" />
</mime-type>
</mime-info>
After running update-mime-database ~/.local/share/mime, any non-empty file with the extension .w is correctly identified in my file-browser as being a text/w file. However, if that file is empty, then it is identified simply as text/plain instead.
Why does this happen? Is this a bug or is it expected behaviour? Is there any way to also get empty files with a .w extension to show up as being of type text/w?
Update: using the mimetype command (as discussed here), as opposed to xdg-mime query filetype or file --mime-type returns the right result even if the file is empty. So presumably the partial answer to my question is that presumably nemo relies on xdg-mime internally. Is there any way to fix this in general via the mime xml definition, or should I simply be raising a bug to nemo to use mimetype instead of xdg-mime instead?
mime-types nemo
add a comment |Â
up vote
3
down vote
favorite
I have tried to install a new mime-type for textfiles with a .w extension as follows:
<?xml version="1.0"?>
<!-- In file ~/.local/share/mime/packages/w.xml -->
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="text/w">
<comment>File of w type</comment>
<glob pattern="*.w" />
</mime-type>
</mime-info>
After running update-mime-database ~/.local/share/mime, any non-empty file with the extension .w is correctly identified in my file-browser as being a text/w file. However, if that file is empty, then it is identified simply as text/plain instead.
Why does this happen? Is this a bug or is it expected behaviour? Is there any way to also get empty files with a .w extension to show up as being of type text/w?
Update: using the mimetype command (as discussed here), as opposed to xdg-mime query filetype or file --mime-type returns the right result even if the file is empty. So presumably the partial answer to my question is that presumably nemo relies on xdg-mime internally. Is there any way to fix this in general via the mime xml definition, or should I simply be raising a bug to nemo to use mimetype instead of xdg-mime instead?
mime-types nemo
There is now a formal bug request on github on this: github.com/linuxmint/nemo/issues/1792
â Tasos Papastylianou
Jul 10 at 10:41
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I have tried to install a new mime-type for textfiles with a .w extension as follows:
<?xml version="1.0"?>
<!-- In file ~/.local/share/mime/packages/w.xml -->
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="text/w">
<comment>File of w type</comment>
<glob pattern="*.w" />
</mime-type>
</mime-info>
After running update-mime-database ~/.local/share/mime, any non-empty file with the extension .w is correctly identified in my file-browser as being a text/w file. However, if that file is empty, then it is identified simply as text/plain instead.
Why does this happen? Is this a bug or is it expected behaviour? Is there any way to also get empty files with a .w extension to show up as being of type text/w?
Update: using the mimetype command (as discussed here), as opposed to xdg-mime query filetype or file --mime-type returns the right result even if the file is empty. So presumably the partial answer to my question is that presumably nemo relies on xdg-mime internally. Is there any way to fix this in general via the mime xml definition, or should I simply be raising a bug to nemo to use mimetype instead of xdg-mime instead?
mime-types nemo
I have tried to install a new mime-type for textfiles with a .w extension as follows:
<?xml version="1.0"?>
<!-- In file ~/.local/share/mime/packages/w.xml -->
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="text/w">
<comment>File of w type</comment>
<glob pattern="*.w" />
</mime-type>
</mime-info>
After running update-mime-database ~/.local/share/mime, any non-empty file with the extension .w is correctly identified in my file-browser as being a text/w file. However, if that file is empty, then it is identified simply as text/plain instead.
Why does this happen? Is this a bug or is it expected behaviour? Is there any way to also get empty files with a .w extension to show up as being of type text/w?
Update: using the mimetype command (as discussed here), as opposed to xdg-mime query filetype or file --mime-type returns the right result even if the file is empty. So presumably the partial answer to my question is that presumably nemo relies on xdg-mime internally. Is there any way to fix this in general via the mime xml definition, or should I simply be raising a bug to nemo to use mimetype instead of xdg-mime instead?
mime-types nemo
edited Feb 28 at 16:08
asked Feb 27 at 14:30
Tasos Papastylianou
1214
1214
There is now a formal bug request on github on this: github.com/linuxmint/nemo/issues/1792
â Tasos Papastylianou
Jul 10 at 10:41
add a comment |Â
There is now a formal bug request on github on this: github.com/linuxmint/nemo/issues/1792
â Tasos Papastylianou
Jul 10 at 10:41
There is now a formal bug request on github on this: github.com/linuxmint/nemo/issues/1792
â Tasos Papastylianou
Jul 10 at 10:41
There is now a formal bug request on github on this: github.com/linuxmint/nemo/issues/1792
â Tasos Papastylianou
Jul 10 at 10:41
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f426952%2fwrong-mime-type-displayed-for-empty-text-files%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
There is now a formal bug request on github on this: github.com/linuxmint/nemo/issues/1792
â Tasos Papastylianou
Jul 10 at 10:41