Loosen strict parsing requirement for desktop files

There are other desktop-looking files, for instance those having to do
with MIME typess, that would benefit from being able to be read by this
function.  It helps to have some flexibility.
* lisp/xdg.el (xdg-desktop-read-file): Remove an error condition.
* test/lisp/xdg-tests.el: Remove a test.
This commit is contained in:
Mark Oteiza 2017-09-25 08:45:08 -04:00
parent c7a0c13777
commit b719f6b20b
2 changed files with 0 additions and 5 deletions

View file

@ -197,8 +197,6 @@ Optional argument GROUP defaults to the string \"Desktop Entry\"."
(unless (looking-at xdg-desktop-group-regexp) (unless (looking-at xdg-desktop-group-regexp)
(error "Expected group name! Instead saw: %s" (error "Expected group name! Instead saw: %s"
(buffer-substring (point) (point-at-eol)))) (buffer-substring (point) (point-at-eol))))
(unless (equal (match-string 1) "Desktop Entry")
(error "Wrong first group: %s" (match-string 1)))
(when group (when group
(while (and (re-search-forward xdg-desktop-group-regexp nil t) (while (and (re-search-forward xdg-desktop-group-regexp nil t)
(not (equal (match-string 1) group))))) (not (equal (match-string 1) group)))))

View file

@ -40,9 +40,6 @@
(should (equal (gethash "Name" tab1) "Test")) (should (equal (gethash "Name" tab1) "Test"))
(should (eq 'default (gethash "Exec" tab1 'default))) (should (eq 'default (gethash "Exec" tab1 'default)))
(should (equal "frobnicate" (gethash "Exec" tab2)))) (should (equal "frobnicate" (gethash "Exec" tab2))))
(should-error
(xdg-desktop-read-file
(expand-file-name "wrong.desktop" xdg-tests-data-dir)))
(should-error (should-error
(xdg-desktop-read-file (xdg-desktop-read-file
(expand-file-name "malformed.desktop" xdg-tests-data-dir))) (expand-file-name "malformed.desktop" xdg-tests-data-dir)))