def GetAppDataFromAppName(AppName): Path = "{1}{0}".format(AppName, TaiyouPath_AppDataFolder) # Check if path exists if not CoreUtils.Directory_Exists(Path): CoreUtils.Directory_MakeDir(Path) return Path
def GenerateCrashLog(): print("Generating crash log...") # Create the directory for the Crash Logs CrashLogsDir = "./Logs/".replace("/", CorePaths.TaiyouPath_CorrectSlash) UTILS.Directory_MakeDir(CrashLogsDir) try: FilePath = CrashLogsDir + SystemFault_ProcessObject.NAME + ".txt" except: FilePath = CrashLogsDir + "unknow_process_name.txt" ProcessInformation = " --- PROCESS INFORMATION ---\n" ProcessInformation += "Name:" try: ProcessInformation += SystemFault_ProcessObject.NAME + "\n" except: ProcessInformation += "Error while parsing\n" ProcessInformation += "PID:" try: ProcessInformation += SystemFault_ProcessObject.PID + "\n" except: ProcessInformation += "Error while parsing\n" ProcessInformation += "ModulePath:" try: ProcessInformation += SystemFault_ProcessObject.ROOT_MODULE + "\n" except: ProcessInformation += "Error while parsing\n" ProcessInformation += "IsFullscreen:" try: ProcessInformation += SystemFault_ProcessObject.FULLSCREEN + "\n" except: ProcessInformation += "Error while parsing\n" ProcessInformation += "HasFocus:" try: ProcessInformation += SystemFault_ProcessObject.APPLICATION_HAS_FOCUS + "\n" except: ProcessInformation += "Error while parsing\n" ProcessInformation += "TitlebarText:" try: ProcessInformation += SystemFault_ProcessObject.TITLEBAR_TEXT + "\n" except: ProcessInformation += "Error while parsing\n" ProcessInformation += "\nAny field with 'Error while parsing' was because the process does not actualy have the variable\n\n --- ERROR TRACEBACK ---" FileWrite = open(FilePath, "w") FileWrite.write(ProcessInformation) FileWrite.write(SystemFault_Traceback) FileWrite.close() print("Crash log completed")
def GenerateCrashLog(self, Traceback, ApplicationName): print("Generating crash log...") # Create the directory for the Crash Logs CrashLogsDir = "./Logs/".replace("/", Core.TaiyouPath_CorrectSlash) UTILS.Directory_MakeDir(CrashLogsDir) # Set the FileName FilePath = CrashLogsDir + ApplicationName + "_boot.txt" # Set the Application Information ProcessInformation = "This application has been failed to boot\n --- Application INFORMATION ---\n" ProcessInformation += "Name:" + ApplicationName + "\n" ProcessInformation += "--- ERROR TRACEBACK ---" FileWrite = open(FilePath, "w") FileWrite.write(ProcessInformation) FileWrite.write(Traceback) FileWrite.close() print("Crash log completed")
def CheckPaths(): global TaiyouPath_CorrectSlash global TaiyouPath_SystemPath global TaiyouPath_TaiyouConfigFile global TaiyouPath_CorrectSlash global TaiyouPath_AppDataFolder global TaiyouPath_RootDevice global TaiyouPath_ApplicationsDataPath global TaiyouPath_SystemDataPath global TaiyouPath_SystemRootPath global TaiyouPath_UserPackpagesPath global TaiyouPath_UserPath global TaiyouPath_UserTempFolder global TaiyouPath_ApplicationsFolder global TaiyouPath_SystemApplicationsFolder global TaiyouPath_ApplicationsDataFolder global TaiyouPath_SystemApplicationsDataFolder global TaiyouPath_UserFilesFolder # -- Set the Correct Slash Directory -- # CurrentPlatform = platform.system() if CurrentPlatform == "Linux": TaiyouPath_CorrectSlash = "/" TaiyouPath_RootDevice = "./Taiyou/" TaiyouPath_SystemPath = "{0}System/CoreFiles/".format(TaiyouPath_RootDevice) TaiyouPath_UserPath = "./Taiyou/User/{0}/".format(getpass.getuser()) TaiyouPath_AppDataFolder = "{0}AppsData/".format(TaiyouPath_UserPath) TaiyouPath_UserPackpagesPath = TaiyouPath_UserPath + "Packpages/" TaiyouPath_UserTempFolder = TaiyouPath_UserPath + "Temporary/" TaiyouPath_ApplicationsDataPath = TaiyouPath_RootDevice + "Data/app/" TaiyouPath_SystemDataPath = TaiyouPath_RootDevice + "Data/system/" TaiyouPath_SystemRootPath = TaiyouPath_RootDevice + "System/" TaiyouPath_TaiyouConfigFile = TaiyouPath_SystemRootPath + "system.config" TaiyouPath_ApplicationsFolder = TaiyouPath_RootDevice + "Applications/" TaiyouPath_SystemApplicationsFolder = TaiyouPath_RootDevice + "System/SystemApps/" TaiyouPath_ApplicationsDataFolder = TaiyouPath_RootDevice + "Data/app/" TaiyouPath_SystemApplicationsDataFolder = TaiyouPath_RootDevice + "Data/system/" TaiyouPath_UserFilesFolder = TaiyouPath_UserPath + "UserFiles/" elif CurrentPlatform == "Windows": TaiyouPath_CorrectSlash = "\\" TaiyouPath_RootDevice = os.getcwd() + "\\Taiyou\\" TaiyouPath_SystemPath = "{0}System\\CoreFiles\\".format(TaiyouPath_RootDevice) TaiyouPath_UserPath = "Taiyou\\User\\{0}\\".format(getpass.getuser()) TaiyouPath_AppDataFolder = "{0}AppsData\\".format(TaiyouPath_UserPath) TaiyouPath_UserPackpagesPath = TaiyouPath_UserPath + "Packpages\\" TaiyouPath_UserTempFolder = TaiyouPath_UserPath + "Temporary\\" TaiyouPath_ApplicationsDataPath = TaiyouPath_RootDevice + "Data\\app\\" TaiyouPath_SystemDataPath = TaiyouPath_RootDevice + "Data\\system\\" TaiyouPath_SystemRootPath = TaiyouPath_RootDevice + "System\\" TaiyouPath_TaiyouConfigFile = TaiyouPath_SystemRootPath + "system.config" TaiyouPath_ApplicationsFolder = TaiyouPath_RootDevice + "Applications\\" TaiyouPath_SystemApplicationsFolder = TaiyouPath_RootDevice + "System\\SystemApps\\" TaiyouPath_ApplicationsDataFolder = TaiyouPath_RootDevice + "Data\\app\\" TaiyouPath_SystemApplicationsDataFolder = TaiyouPath_RootDevice + "Data\\system\\" TaiyouPath_UserFilesFolder = TaiyouPath_UserPath + "UserFiles\\" # Creates user folder CoreUtils.Directory_MakeDir(TaiyouPath_UserTempFolder) CoreUtils.Directory_MakeDir(TaiyouPath_UserPackpagesPath) CoreUtils.Directory_MakeDir(TaiyouPath_UserFilesFolder)
def ApplicationInstallingUpdateProgress(self): print("Instalation Progress Update\nStep: {0}".format(str(self.PackpageInstalationStep))) PackpagePath = CorePaths.TaiyouPath_UserPackpagesPath + self.SelectedPackpage + self.ContentManager.Get_RegKey("/packpage_file_format") # Check if File exists if self.PackpageInstalationStep == 1: if self.SelectedPackpage == "" or not CoreUtils.File_Exists(PackpagePath): self.FinishInstalation() elif self.PackpageInstalationStep == 2: # Check if Extract Path exists and clean it print("Packpage : {0}".format(self.SelectedPackpage)) self.ExtractPath = CorePaths.TaiyouPath_UserTempFolder + self.SelectedPackpage print("ExtractPath : " + self.ExtractPath) # Check if Extract Path Exists if CoreUtils.Directory_Exists(self.ExtractPath): print("Extraction Path Exists, Directory Removed and Re-Created") CoreUtils.Directory_Remove(self.ExtractPath) CoreUtils.Directory_MakeDir(self.ExtractPath) elif self.PackpageInstalationStep == 3: # Extract the Packpage # Extract the Zip File print("Un-Zipping packpage....") CoreUtils.Unzip_File(PackpagePath, self.ExtractPath) elif self.PackpageInstalationStep == 4: # Check if Packpage is Valid print("Check for app and data folder on extracted path") self.AppFolderPath = self.ExtractPath + CorePaths.TaiyouPath_CorrectSlash + "app" + CorePaths.TaiyouPath_CorrectSlash self.DataFolderPath = self.ExtractPath + CorePaths.TaiyouPath_CorrectSlash + "data" + CorePaths.TaiyouPath_CorrectSlash AppFolderExists = CoreUtils.Directory_Exists(self.AppFolderPath) DataFolderExists = CoreUtils.Directory_Exists(self.DataFolderPath) if not AppFolderExists or not DataFolderExists: self.FinishInstalation(True) self.SetStatusText(self.ContentManager.Get_RegKey("/strings/invalid_taiyou_packpage")) elif self.PackpageInstalationStep == 5: # Check if Application Already Exists AppFolderInsideIt = os.listdir(self.AppFolderPath)[0] CheckPath = CorePaths.TaiyouPath_ApplicationsFolder + AppFolderInsideIt if CoreUtils.Directory_Exists(CheckPath) and not self.IgnorePackpageReplace: self.PackpageReplaceWarning = True return if self.IgnorePackpageReplace: print("Package will replace, check for conflicting directories...") FolderInAppPath = os.listdir(self.AppFolderPath) for folder in FolderInAppPath: # Check if folder exists CheckPath = ''.join((CorePaths.TaiyouPath_ApplicationsFolder, folder)) if CheckPath == CorePaths.TaiyouPath_ApplicationsFolder: print("WARNING : This function almost deleted all of your installed applications.\nWe have an protection to prevent this.") continue print("CheckPath : " + CheckPath) if CoreUtils.Directory_Exists(CheckPath): print("Detected conflict between installed application folder.\nDeleting current existing folder.") CoreUtils.Directory_Remove(CheckPath) FolderInDataPath = os.listdir(self.DataFolderPath) for folder in FolderInDataPath: # Check if folder exists CheckPath = ''.join((CorePaths.TaiyouPath_ApplicationsDataPath, folder)) if CheckPath == CorePaths.TaiyouPath_ApplicationsDataPath: print("WARNING : This function almost deleted all of your installed applications data.\nWe have an protection to prevent this.") continue print("CheckPath : " + CheckPath) if CoreUtils.Directory_Exists(CheckPath): print("Detected conflict between installed application data folder.\nDeleting current existing folder.") CoreUtils.Directory_Remove(CheckPath) print("Copy Application to Application Folder...") CoreUtils.Directory_Copy(self.AppFolderPath[:-1], CorePaths.TaiyouPath_ApplicationsFolder[:-1]) elif self.PackpageInstalationStep == 6: # Copy the Application Folder print("Copy Application to Application Folder...") CoreUtils.Directory_Copy(self.AppFolderPath, CorePaths.TaiyouPath_ApplicationsFolder[:-1]) elif self.PackpageInstalationStep == 7: print("Copy Application Data to Application Data Folder...") CoreUtils.Directory_Copy(self.DataFolderPath, CorePaths.TaiyouPath_ApplicationsDataFolder) elif self.PackpageInstalationStep == 8: self.InstalationCompleteDeletePackpage = True