GSoC/GCI Archive
Google Code-in 2011 Haiku

Implement Haiku version of BeOS 'setmime' (MIME types handling) command line tool.

completed by: Alex11223

mentors: Siarhei Zharski

Haiku still lacks some command-line tools provided with BeOS. One of them is 'setmime' - that has functionality similar to FileTypes modules.  This tool allows to investigate and modify system-registered MIME types from the shell interface and could be very usefull for performing some automated tasks - like installer shell scripts.
 
Your Task is:

  • Implement the setmime replacement tool for Haiku as close to original BeOS version as possible. JFYI, BeOS compatibility is one of general requirements in Haiku Project;
  • Extend the functionality of the setmime tool to work with vector icons  types - BeOS has only bitmap icons;


Interface of BeOS version:

calling "setmime" without parameters produce following output:

# setmime:
# usage: setmime ((-dump | -dumpSniffRule | -dumpIcon | -dumpAll) [ <signatureString> ] )
#      | (-remove <signatureString> )
#      | ( (-set | -force | -add)  <signatureString>
#          [ -short <short description> ] [ -long <long description> ]
#          [ -preferredApp <preferred app path> ]
#          [ -preferredAppSig <preferred app signature> ]
#          [ -sniffRule <sniffRule> ]
#          [ -extension <file suffix> ]
#          [ -attribute <internal name>
#             [ -attrName <public name> ] [ -attrType <type code> ]
#             [ -attrWidth <display width> ] [ -attrAlignment <position> ]
#             [ -attrViewable <bool flag> ] [ -attrEditable <bool flag> ]
#             [ -attrExtra <bool flag> ] ]
#          [ -miniIcon <256 hex bytes> ]
#          [ -largeIcon <1024 hex bytes> ] ... )
#      | (-checkSniffRule <sniffRule>
#      | -includeApps)

calling "setmime --help" produce the output above with additional explanation:


#  -dump prints a specified metamime
#  -remove removes specified metamime
#  -add adds specified metamime and specified metamime attributes
#      that have not yet been defined
#  -set adds specified metamime and specified metamime attributes,
#      overwrites the existing values of specified metamime attributes
#  -force adds specified metamime and specified metamime attributes
#      after first erasing all the existing attributes
#  -dumpSniffRule prints just the MIME sniffer rule of a specified metamime
#     -dumpIcon prints just the icon information of a specified metamime
#  -dumpAll prints all the information, including icons of a specified metamime
#  -checkSniffRule parses a MIME sniffer rule and reports any errors
#  -includeApps will include applications

Links:
http://haiku-os.org/legacy-docs/bebook/BMimeType.html - BMimeType reference;
http://haiku-os.org/development - info for Haiku development;
https://www.haiku-os.org/development/coding-guidelines - Haiku Coding Guidelines;

Good luck and feel free to ask your mentor for any additional information and materials!