forked from BSVino/docs.gl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
find_glsl.py
38 lines (29 loc) · 1.17 KB
/
find_glsl.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Copy GLSL Docs from gl4 to sl4
# Copy GLSL Docs from es3 to el3
import shutil, glob, os ,ntpath
path = os.path.dirname(os.path.abspath(__file__))
def make_glsl_docs():
print("Creating GLSL docs ...")
sl_filenames = glob.glob(path+"\\gl4\\"+'*.xhtml')
if not os.path.exists("sl4"):
os.makedirs("sl4")
get_glsl_docs(sl_filenames , "sl4")
es_filenames = glob.glob(path+"\\es3\\"+'*.xhtml')
if not os.path.exists("el3"):
os.makedirs("el3")
get_glsl_docs(es_filenames , "el3" )
print("done")
def get_glsl_docs( filenames, foldername ):
findtext = ""
if foldername[0:2] == "el":
findtext = "OpenGL ES Shading Language Version"
elif foldername[0:2] == "sl":
findtext = "OpenGL Shading Language Version"
print(foldername[0:2])
for filename in filenames:
with open(filename, 'r') as readfile:
if(readfile.read().find(findtext) != -1):
readfile.close()
#change .copy .move to get them out of GL directories
shutil.copy(filename, path+"\\"+foldername+"\\"+ ntpath.basename(filename))
make_glsl_docs()