summaryrefslogtreecommitdiff
path: root/test/test-desktop.py
blob: 831c368d740ae9e33136ecb32c9b5c2548a3ebdc (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/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!")