如何验证/验证.desktop文件?


12

我有几个.desktop文件无法正常工作或根本无法工作。我在任何地方都看不到任何错误,因此寻求帮助似乎无济于事。有没有一种方法可以验证我在文件中使用的语法正确,并且符合FreeDesktop标准,因此可以应用特定的修复程序?

Answers:


20

您正在寻找发行版中desktop-files-utils软件包desktop-file-validate提供的工具。总而言之,它使用保留字/字符检查语法是否符合Desktop Entry规范。这是一个错误的.desktop文件的示例:

➜  ~  desktop-file-validate asdf.desktop 
asdf.desktop: error: value "cd /opt/sqldeveloper/sqldeveloper/bin && bash sqldeveloper $*" for key "Exec" in group "Desktop Entry" contains a reserved character '&' outside of a quote
asdf.desktop: error: value "cd /opt/sqldeveloper/sqldeveloper/bin && bash sqldeveloper $*" for key "Exec" in group "Desktop Entry" contains a reserved character '&' outside of a quote
asdf.desktop: error: value "cd /opt/sqldeveloper/sqldeveloper/bin && bash sqldeveloper $*" for key "Exec" in group "Desktop Entry" contains a reserved character '$' outside of a quote
asdf.desktop: error: value "cd /opt/sqldeveloper/sqldeveloper/bin && bash sqldeveloper $*" for key "Exec" in group "Desktop Entry" contains a reserved character '*' outside of a quote
asdf.desktop: hint: value item "GNOME" in key "Categories" in group "Desktop Entry" can be extended with another category among the following categories: GTK
asdf.desktop: error: value "GNOME;Oracle;Utility;Development;" for key "Categories" in group "Desktop Entry" contains an unregistered value "Oracle"; values extending the format should start with "X-"
asdf.desktop: hint: value "GNOME;Oracle;Utility;Development;" for key "Categories" in group "Desktop Entry" contains more than one main category; application might appear more than once in the application menu
asdf.desktop: error: value "s.0.m.t.h.i.n.g" for key "Version" in group "Desktop Entry" is not a known version

诸如此类的好文件caribou-autostart.desktop不会显示任何内容。


FTR desktop-file-validate可能没有显示任何错误,但由于在上的无效输入,因此可能仍然根本不起作用Exec
Pablo A
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.