blob: b31ed6137d8cc932c4bf783225fb35f0ecb9926b [file] [log] [blame]
Christian Heimesd9fbab22008-01-02 17:43:40 +00001from __future__ import with_statement
2import os
3
4def vs9to8(src, dest):
5 for name in os.listdir(src):
6 path, ext = os.path.splitext(name)
7 if ext.lower() not in ('.sln', '.vcproj', '.vsprops'):
8 continue
9
10 filename = os.path.normpath(os.path.join(src, name))
11 destname = os.path.normpath(os.path.join(dest, name))
12 print("%s -> %s" % (filename, destname))
13
Christian Heimesfed3ebc2008-01-02 18:28:32 +000014 with open(filename, 'rU') as fin:
Christian Heimesd9fbab22008-01-02 17:43:40 +000015 lines = fin.read()
16 lines = lines.replace('Version="9,00"', 'Version="8.00"')
17 lines = lines.replace('Version="9.00"', 'Version="8.00"')
18 lines = lines.replace('Format Version 10.00', 'Format Version 9.00')
19 lines = lines.replace('Visual Studio 2008', 'Visual Studio 2005')
20
21 lines = lines.replace('wininst-9.0', 'wininst-8.0')
22 lines = lines.replace('..\\', '..\\..\\')
23 lines = lines.replace('..\\..\\..\\..\\', '..\\..\\..\\')
24
Christian Heimesfed3ebc2008-01-02 18:28:32 +000025 with open(destname, 'wb') as fout:
26 lines = lines.replace("\n", "\r\n")
Christian Heimesd9fbab22008-01-02 17:43:40 +000027 fout.write(lines)
28
29if __name__ == "__main__":
Christian Heimesfed3ebc2008-01-02 18:28:32 +000030 vs9to8(src=".", dest="../PC/VS8.0")