File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ from lib2to3 .pgen2 .token import OP
2+ import os
3+ from turtle import fd
4+
5+ # Change this values according to your Project.
6+ ModuleName = os .path .split (os .path .split (__file__ )[0 ])[1 ]
7+ ModuleDescription = ""
8+
9+ ScriptName = os .path .split (__file__ )[1 ]
10+
11+ # Check name
12+ if ' ' in ModuleName :
13+ raise NameError ("Module name have space." )
14+ elif ModuleName == 'Magisk-Module-Template' :
15+ raise NotImplementedError ()
16+
17+ def makeTree (source = '.' ):
18+ tree = []
19+ for p in os .listdir (source ):
20+ if os .path .isdir (os .path .join (source , p )) and not p in ['.git' , '.vs' ]:
21+ for path in makeTree (os .path .join (source , p )):
22+ tree .append (path )
23+ elif os .path .isfile (os .path .join (source , p )) and not p in [ScriptName ]:
24+ tree .append (os .path .join (source , p ))
25+ return tree
26+
27+ for f in makeTree ():
28+ with open (f , 'r' ) as file :
29+ fData = file .read ()
30+
31+ hasModified = False
32+ # Replace module name
33+ if '@(ModuleName)' in fData :
34+ fData = fData .replace ('@(ModuleName)' , ModuleName )
35+ hasModified = True
36+ #Replace module description
37+ if '@(ModuleDescription)' in fData :
38+ fData = fData .replace ('@(ModuleDescription)' , ModuleDescription )
39+ hasModified = True
40+
41+ # Do modifications
42+ if hasModified :
43+ with open (f 'w' ) as file :
44+ file .write (fData )
45+
You can’t perform that action at this time.
0 commit comments