Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Making use of the path passed with -p when compiling a Pd file.
Browse files Browse the repository at this point in the history
Closes #6 #6.
Note that this is still outstanding when using max2hv.
  • Loading branch information
giuliomoro committed Aug 28, 2018
1 parent 9c17338 commit 50329d8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
16 changes: 14 additions & 2 deletions interpreters/pd2hv/PdParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,16 @@ def __get_pd_line(clazz, pd_path):
else:
concat = (concat + " " + l) if len(concat) > 0 else l

def add_search_paths(self, search_paths):
count = 0;
if search_paths:
for search_path in search_paths:
search_dir = os.path.abspath(search_path)
if os.path.isdir(search_dir):
self.__search_paths.append(search_dir)
count += 1
return count

def add_relative_search_directory(self, search_dir):
search_dir = os.path.abspath(os.path.join(
self.__search_paths[0],
Expand Down Expand Up @@ -143,9 +153,11 @@ def graph_from_file(self, file_path, obj_args=None, pos_x=0, pos_y=0, is_root=Tr
""" Instantiate a PdGraph from a file.
Note that obj_args does not include $0.
@param pd_graph_class The python class to handle specific graph types
@param is_root if True, the folder containing file_path is assumed
to be the root path of the whole systen. If False, the first entry of
self.__search_paths will be the root.
"""
# add main patch directory. The first entry of self.__search_paths is
# assumed to be the root path of the whole system
# add main patch directory.

if is_root:
self.__search_paths.append(os.path.dirname(file_path))
Expand Down
1 change: 1 addition & 0 deletions interpreters/pd2hv/pd2hv.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def compile(clazz, pd_path, hv_dir, search_paths=None, verbose=False, export_arg
tick = time.time()

parser = PdParser() # create parser state
parser.add_search_paths(search_paths)
pd_graph = parser.graph_from_file(pd_path)
notices = pd_graph.get_notices()

Expand Down

0 comments on commit 50329d8

Please sign in to comment.