| Conditions | 6 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | #!/usr/bin/env python |
||
| 32 | @classmethod |
||
| 33 | def findFile(cls, filename): |
||
| 34 | if os.path.isfile(filename): |
||
| 35 | return filename |
||
| 36 | |||
| 37 | command = sys.argv[0] |
||
| 38 | if '/' != command[0]: |
||
| 39 | command = os.path.normpath(os.path.join(os.getcwd(), command)) |
||
| 40 | path = os.path.join(os.path.dirname(os.path.dirname(command)), 'etc', filename) |
||
| 41 | if os.path.isfile(path): |
||
| 42 | return path |
||
| 43 | |||
| 44 | if ':' in filename: |
||
| 45 | return cls.findFile(filename.split(':', 1)[0]) |
||
| 46 | |||
| 47 | ext = os.path.splitext(filename)[1] |
||
| 48 | |||
| 49 | if ext != '.json': |
||
| 50 | return cls.findFile(filename + '.json') |
||
| 51 | else: |
||
| 52 | return os.path.join('/etc/heppy', filename) |
||
| 53 | |||
| 54 |