forked from Answeror/lit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
28 lines (22 loc) · 751 Bytes
/
run.py
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from files import Files
class Run(Files):
def __init__(self, worker, **kargs):
super(Run, self).__init__(worker, **kargs)
self._paths = []
for path in os.environ['PATH'].split(os.pathsep):
path = os.path.expandvars(path)
if os.path.exists(path):
for filename in os.listdir(path):
_, ext = os.path.splitext(filename)
if ext in ['.exe', '.cmd', '.bat', '.lnk']:
self._paths.append(os.path.join(path, filename))
self.path_list_changed()
@property
def paths(self):
return self._paths
@property
def name(self):
return 'r'