add support for defining order via a .order file
This commit is contained in:
parent
eaa03a6f2c
commit
4d5d31a2b0
|
@ -0,0 +1 @@
|
||||||
|
+ OptionsManager.js
|
|
@ -359,6 +359,23 @@ class ScriptResource(resource.Resource, component.Component):
|
||||||
for dirpath, dirnames, filenames in os.walk(filepath, False):
|
for dirpath, dirnames, filenames in os.walk(filepath, False):
|
||||||
files = fnmatch.filter(filenames, "*.js")
|
files = fnmatch.filter(filenames, "*.js")
|
||||||
files.sort()
|
files.sort()
|
||||||
|
|
||||||
|
order_file = os.path.join(dirpath, '.order')
|
||||||
|
if os.path.isfile(order_file):
|
||||||
|
for line in open(order_file, 'rb'):
|
||||||
|
line = line.strip()
|
||||||
|
if not line or line[0] == '#':
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
pos, filename = line.split()
|
||||||
|
files.pop(files.index(filename))
|
||||||
|
if pos == '+':
|
||||||
|
files.insert(0, filename)
|
||||||
|
else:
|
||||||
|
files.append(filename)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
dirpath = dirpath[len(filepath)+1:]
|
dirpath = dirpath[len(filepath)+1:]
|
||||||
if dirpath:
|
if dirpath:
|
||||||
scripts.extend(['js/' + path + '/' + dirpath + '/' + f for f in files])
|
scripts.extend(['js/' + path + '/' + dirpath + '/' + f for f in files])
|
||||||
|
|
Loading…
Reference in New Issue