summaryrefslogtreecommitdiff
path: root/test/test-desktop.py
blob: 8304b62e1006e974a3a69ebd35889775ef5748bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python
from xdg.DesktopEntry import *

import os, sys

def checkfiles(path):
    if os.path.isdir(path):
        ls = os.listdir(path)
        for file in ls:
            checkfiles(os.path.join(path, file))
    else:
        entry = DesktopEntry()
        try:
            entry.parse(path)
        except ParsingError, e:
            print e
            return

        entry.setLocale("C")
        entry.getName()

        try:
            entry.validate()
        except ValidationError, e:
            print e

try:
    checkfiles(sys.argv[1])

except IndexError:
    print("No file or directory given!")