-
Notifications
You must be signed in to change notification settings - Fork 1
/
vs2019_2017.py
40 lines (37 loc) · 916 Bytes
/
vs2019_2017.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
import os
import glob
def v142_141(path):
os.chdir(path)
files=glob.glob('*.vcxproj')
for file in files:
fid = open(file,'r')
fid2 = open(file+'0','w')
lastpt = 0
fid.seek(0,0)
while 1:
line = fid.readline()
pt = fid.tell()
if (len(line)==0):
break
loc = line.find('<PlatformToolset>')
if loc >= 0:
loc1 = line.find('</PlatformToolset>')
if loc1 < 0:
print('<PlatformToolset> not matched in ' + file + ' !')
fid.close()
return
fid2.write(line[0:loc+len('<PlatformToolset>')])
targetStr = line[loc+len('<PlatformToolset>'):loc1]
if targetStr == 'v142':
fid2.write('v141')
else:
fid2.write(targetStr)
after_targetStr = line[loc+len('<PlatformToolset>')+4:len(line)]
fid2.write(after_targetStr)
else:
fid2.write(line)
fid.close()
fid2.close()
os.remove(file)
os.rename(file+'0',file)
v142_141("c:\\temp\\temp")