mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2024-11-21 14:18:57 -07:00
Read the data files from the same path where the script resides.
This commit is contained in:
parent
ac9f0c30a5
commit
a9179f2779
2 changed files with 9 additions and 2 deletions
|
@ -21,6 +21,7 @@
|
|||
# TODO: Add info to be able to propagate error position to the source.
|
||||
|
||||
from lslcommon import Key, Vector, Quaternion
|
||||
import lslcommon
|
||||
import lslfuncs
|
||||
import sys, re
|
||||
from base64 import b64encode
|
||||
|
@ -2326,7 +2327,7 @@ list lazy_list_set(list L, integer i, list v)
|
|||
parse_num_re = re.compile(r'^\s*(-?(?=[0-9]|\.[0-9])[0-9]*((?:\.[0-9]*)?(?:[Ee][+-]?[0-9]+)?))\s*$')
|
||||
parse_str_re = re.compile(ur'^"((?:[^"\\]|\\.)*)"$')
|
||||
|
||||
f = open('builtins.txt', 'rb')
|
||||
f = open(lslcommon.DataPath + 'builtins.txt', 'rb')
|
||||
try:
|
||||
while True:
|
||||
line = f.readline()
|
||||
|
@ -2443,7 +2444,7 @@ list lazy_list_set(list L, integer i, list v)
|
|||
f.close()
|
||||
|
||||
# Load the side-effect-free table as well.
|
||||
f = open('seftable.txt', 'rb')
|
||||
f = open(lslcommon.DataPath + 'seftable.txt', 'rb')
|
||||
try:
|
||||
while True:
|
||||
line = f.readline()
|
||||
|
|
6
main.py
6
main.py
|
@ -23,6 +23,8 @@ from lslopt.lslparse import parser,EParse
|
|||
from lslopt.lsloutput import outscript
|
||||
from lslopt.lsloptimizer import optimizer
|
||||
import sys
|
||||
import os
|
||||
import lslopt.lslcommon
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 2:
|
||||
|
@ -129,6 +131,10 @@ Options (+ means active by default, - means inactive by default):
|
|||
'optsigns','optfloats','constfold','dcr'
|
||||
))
|
||||
|
||||
# If it's good to append the basename to it, it's good to append the
|
||||
# auxiliary files' names to it.
|
||||
lslopt.lslcommon.DataPath = __file__[:-len(os.path.basename(__file__))]
|
||||
|
||||
if sys.argv[1] == '-O':
|
||||
if len(sys.argv) < 4:
|
||||
sys.stderr.write('Command line: Not enough parameters\n')
|
||||
|
|
Loading…
Reference in a new issue