Linux mime-type association doesn't recognize Mentor-generated gerbers
Description
Kicad's file associations on Linux fail to detect the mime type of gerbers with the gdo extension which were generated using Mentor Expedition 2009.
The 'magic' header checks in /usr/share/mime/packages/kicad-gerbers.xml
seem to only check the first line, however these gerbers are generated with an empty 'Block command' on the first line (first line is just an asterisk). Therefore all five checks for possible command blocks fail, and the file is not recognized as gerber.
Steps to reproduce
$ echo "*
G04 some comment" > test.gdo
$ mimetype -a test.gdo
test.gdo: text/plain
Replace the five <match type="string" offset="0"
occurrences in the "Gerber file" section of /usr/share/mime/packages/kicad-gerbers.xml
to <match type="string" offset="0:3"
.
The range 0..3 allows it to skip the asterisk and lf/crlf when matching.
$ sudo update-mime-database /usr/share/mime
$ mimetype -a test.gdo
test.gdo: application/x-gerber
test.gdo: text/plain
KiCad Version
Application: KiCad
Version: 6.0.6-3a73a75311~116~ubuntu20.04.1, release build
Libraries:
wxWidgets 3.0.4
libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Platform: Linux 5.4.0-122-generic x86_64, 64 bit, Little endian, wxGTK, unity, x11
Build Info:
Date: Jun 20 2022 15:49:56
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
Boost: 1.71.0
OCC: 7.5.2
Curl: 7.83.1
ngspice: 36
Compiler: GCC 9.4.0 with C++ ABI 1013
Build settings:
KICAD_USE_OCC=ON
KICAD_SPICE=ON