-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed platform specific code parsing errors.
- Loading branch information
Roberto
committed
Dec 14, 2018
1 parent
b7cf1ae
commit 81ab810
Showing
14 changed files
with
293 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,31 @@ | ||
import inspect, os | ||
import pathlib | ||
import os, sys, platform | ||
|
||
here=os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) # script directory | ||
here=pathlib.Path(here) | ||
root=pathlib.Path(*here.parts[:-1]) | ||
CONFIG={} | ||
#CONFIG['fdtd_path']="/Applications/Lumerical/FDTD Solutions/FDTD Solutions.app/Contents/API/Python" | ||
CONFIG['root']=str(root.absolute()) | ||
print 'CONFIGURATION FILE {}'.format(CONFIG) | ||
# add lumopt.py to system path | ||
lumopt_dir_name = os.path.dirname(__file__) | ||
parent_dir_name = os.path.dirname(lumopt_dir_name) | ||
if parent_dir_name not in sys.path: | ||
sys.path.append(parent_dir_name) | ||
|
||
## Geeze this seems awefully complicated, is there no other way to do it better?? | ||
# look for lumapi.py in system path | ||
python_api_path = '' | ||
for dir_name in sys.path: | ||
if os.path.isfile(os.path.join(dir_name, 'lumapi.py')): | ||
python_api_path = dir_name; break | ||
# if search comes out empty, look in the default install path | ||
if not python_api_path: | ||
current_platform = platform.system() | ||
default_api_path = '' | ||
if current_platform == 'Windows': | ||
default_api_path = '/Program Files/Lumerical/FDTD/api/python' | ||
elif current_platform == 'Darwin': | ||
default_api_path = '/Applications/Lumerical/FDTD/FDTD.app/Contents/MacOS/' | ||
elif current_platform == 'Linux': | ||
default_api_path = '/opt/lumerical/FDTD/bin' | ||
default_api_path = os.path.normpath(default_api_path) | ||
if os.path.isfile(os.path.join(default_api_path, 'lumapi.py')): | ||
sys.path.append(default_api_path) | ||
python_api_path = default_api_path | ||
|
||
# save paths for subsequent file access | ||
CONFIG = {'root' : parent_dir_name, 'lumapi' : python_api_path} | ||
print('CONFIGURATION FILE {}'.format(CONFIG)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.