Merge pull request #316 from cuu/master

try to add a simple way to re-install the CommercialSoftwarePackage
This commit is contained in:
GNU 2019-12-25 21:32:44 +08:00 committed by GitHub
commit edbcd7d47a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -340,6 +340,12 @@ class MyCommercialSoftwarePackage(object):
def API(self,main_screen):
if main_screen !=None:
if self._Done != "":
#try to check if the installed package still there, if not ,remove the done flag file
if FileExists(os.path.join(self._ComPkgInfo["GameDir"],self._ComPkgInfo["InstallDir"] )) == False:
done_file = os.path.join( os.path.dirname(self._Done),".done")
if FileExists(done_file):
os.remove(done_file)
main_screen._MsgBox.SetText("Starting")
main_screen._MsgBox.Draw()
main_screen.SwapAndShow()

View File

@ -539,12 +539,15 @@ class MainScreen(Widget):
elif self.IsCommercialPackage( os.path.join(_dir,i)):
data = None
em = MyCommercialSoftwarePackage()
with open(os.path.join(_dir,i) +"/"+commercialsoftware_flag) as f:
data = json.load(f)
if FileExists( _dir+"/"+i+"/.done"):
print(_dir+"/"+i+"/.done")
em._Done = os.path.realpath(_dir+"/"+i+"/"+i2+".sh")
em._ComPkgInfo = data
else:
with open(os.path.join(_dir,i) +"/"+commercialsoftware_flag) as f:
data = json.load(f)
em._ComPkgInfo = data
em._Done = ""