Skip to content

Commit

Permalink
dont remove WebPatch
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesneimog committed Nov 12, 2024
1 parent 0fb2066 commit 90a94ed
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Tests/Libraries/**/WebPatch/
Tests/Libraries/**/build/
Tests/**/CMakeLists.txt

Tests/Libraries/else/else/else-000-010
Tests/Basic/gui/Pd4Web
Tests/Basic/gui/WebPatch
Tests/Basic/gui/.gitignore
Expand Down
9 changes: 4 additions & 5 deletions Sources/pd4web/Builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,9 @@ def searchCFunction(self, patchLine: PatchLine, root, file):
if "." in functionName:
functionName = functionName.replace(".", "0x2e")
self.regexSearch(patchLine, functionName, os.path.join(root, file))


def getObjectsSourceCode(self):
for patchLine in self.Patch.patchLinesProcessed:
#print(patchLine, patchLine.isExternal)
if patchLine.isExternal:
foundLibrary = self.Libraries.GetLibrarySourceCode(patchLine.library)
if foundLibrary:
Expand Down Expand Up @@ -226,7 +224,7 @@ def BuildExternalsObjects(self):
continue
libraryPath = self.Pd4Web.PROJECT_ROOT + "/Pd4Web/Externals/" + library
for pdobject in objects:

if pdobject not in self.Pd4Web.externalsLinkLibraries:
self.Pd4Web.externalsLinkLibraries.append(pdobject)
if libraryPath + "/build" not in self.Pd4Web.externalsLinkLibrariesFolders:
Expand Down Expand Up @@ -459,16 +457,17 @@ def CopyExtraJsFiles(self):
f.write(" </script>\n")
f.write(" </body>\n")
f.write("</html>\n")

if self.Pd4Web.TEMPLATE != 0:
print(self.Pd4Web.TEMPLATE)
root = os.path.join(self.Pd4Web.PD4WEB_ROOT, "..", f"Templates/{self.Pd4Web.TEMPLATE}")
if not os.path.exists(root):
raise Exception(f"Error: Could not find template {self.Pd4Web.TEMPLATE}")
files = os.listdir(root)
# copy all files inside the template folder to self.Pd4Web.PROJECT_ROOT
for file in files:
shutil.copy(os.path.join(root, file), self.Pd4Web.PROJECT_ROOT + "/WebPatch/")

os.chdir(cwd)

def __repr__(self) -> str:
Expand Down
14 changes: 7 additions & 7 deletions Sources/pd4web/Pd4Web.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class Pd4Web:
# Paths
PD4WEB_LIBRARIES: str = ""
PD_EXTERNAL: bool = False

# User
TEMPLATE: int = 0

# Dev
BYPASS_UNSUPPORTED: bool = False
SILENCE: bool = False
Expand Down Expand Up @@ -237,8 +237,8 @@ def do_actions(self, parser):
if parser.clear:
shutil.rmtree(os.path.join(self.PROJECT_ROOT, "build"), ignore_errors=True)
shutil.rmtree(os.path.join(self.PROJECT_ROOT, "Pd4Web"), ignore_errors=True)
#shutil.rmtree(os.path.join(self.PROJECT_ROOT, "WebPatch"), ignore_errors=True)
# shutil.rmtree(os.path.join(self.PROJECT_ROOT, "WebPatch"), ignore_errors=True)

if parser.add_lib_cmake:
newLibCmake = parser.add_lib_cmake
if not os.path.exists(newLibCmake):
Expand Down Expand Up @@ -268,7 +268,7 @@ def action_flags(self, parser):
default=False,
help="Use Emscripten to run the Browser",
)

parser.add_argument(
"--add-lib-cmake",
required=False,
Expand Down Expand Up @@ -340,12 +340,12 @@ def options_flags(self, parser):
action="store_true",
help="If is it pd4web external",
)

## User
parser.add_argument(
"--template",
required=False,
default=1,
default=0,
type=int,
help="Number of the template to use, check https://charlesneimog.github.io/pd4web/en/patch/templates",
)
Expand Down

0 comments on commit 90a94ed

Please sign in to comment.