@@ -31,30 +31,21 @@ init python:
31
31
renpy.quit(relaunch = True )
32
32
33
33
def readVersion ():
34
- if persistent.projects_directory is not None :
35
- # move renpy-version.txt to project game folder for easy transfer
36
- old_txt_path = os.path.join(persistent.projects_directory, project.current.name, ' renpy-version.txt' ).replace(" \\ " , " /" )
37
-
38
- if os.path.exists(old_txt_path):
39
- new_txt_path = os.path.join(persistent.projects_directory, project.current.name, ' game/renpy-version.txt' ).replace(" \\ " , " /" )
40
- try :
41
- renpy.file(old_txt_path)
42
- shutil.move(old_txt_path, new_txt_path)
43
- except IOError : pass
44
- else :
45
- new_txt_path = os.path.join(config.basedir, project.current.name, ' game/renpy-version.txt' ).replace(" \\ " , " /" )
46
- else :
47
- new_txt_path = os.path.join(config.basedir, project.current.name, ' game/renpy-version.txt' ).replace(" \\ " , " /" )
34
+ old_txt_path = os.path.join(project.current.path, ' renpy-version.txt' ).replace(" \\ " , " /" )
35
+ new_txt_path = os.path.join(project.current.path, ' game/renpy-version.txt' ).replace(" \\ " , " /" )
36
+
37
+ if os.path.exists(old_txt_path):
38
+ shutil.move(old_txt_path, new_txt_path)
39
+
48
40
try :
49
41
with open (new_txt_path) as f:
50
- file_ver = f.readline().strip()
42
+ file_ver = int ( f.readline().strip() )
51
43
52
- int_ver = int (file_ver)
53
- if int_ver >= 6 and int_ver <= 8 :
54
- return int_ver
44
+ if file_ver >= 6 and file_ver <= 8 :
45
+ return file_ver
55
46
else :
56
47
return - 1
57
- except IOError :
48
+ except IOError :
58
49
return None
59
50
except ValueError :
60
51
return - 1
0 commit comments