Linux command
desktop-file-validate 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Validate a desktop entry file
desktop-file-validate [path/to/file.desktop]
Validate multiple files
desktop-file-validate [file1.desktop] [file2.desktop]
Validate without deprecation warnings
desktop-file-validate --no-warn-deprecated [path/to/file.desktop]
Validate and warn about KDE-specific extensions
desktop-file-validate --warn-kde [path/to/file.desktop]
Validate all desktop files
desktop-file-validate /usr/share/applications/*.desktop
说明
desktop-file-validate validates desktop entry files (.desktop files) according to the freedesktop.org Desktop Entry Specification. Desktop entry files provide information such as application name, icon, description, and categories for application launchers and menus. The validation checks for mandatory keys, correct value types, proper escaping, valid categories, and common errors that could cause improper display or misbehavior. The tool is commonly used in packaging workflows and build systems to ensure desktop entries meet specification requirements. The command returns exit status 0 if all files are valid with no errors or strict warnings. A non-zero exit status (typically 1) indicates validation failures.
参数
- --no-warn-deprecated
- Do not warn about usage of deprecated items from previous specification versions.
- --warn-kde
- Warn about KDE-specific extensions including KDE Desktop Entry group, ServiceTypes, DocPath, Keywords, InitialPreference keys, and Service/ServiceType/FSDevice types.
FAQ
What is the desktop-file-validate command used for?
desktop-file-validate validates desktop entry files (.desktop files) according to the freedesktop.org Desktop Entry Specification. Desktop entry files provide information such as application name, icon, description, and categories for application launchers and menus. The validation checks for mandatory keys, correct value types, proper escaping, valid categories, and common errors that could cause improper display or misbehavior. The tool is commonly used in packaging workflows and build systems to ensure desktop entries meet specification requirements. The command returns exit status 0 if all files are valid with no errors or strict warnings. A non-zero exit status (typically 1) indicates validation failures.
How do I run a basic desktop-file-validate example?
Run `desktop-file-validate [path/to/file.desktop]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --no-warn-deprecated do in desktop-file-validate?
Do not warn about usage of deprecated items from previous specification versions.