-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmixperfect_upgrader.pb
More file actions
51 lines (40 loc) · 1.42 KB
/
Copy pathmixperfect_upgrader.pb
File metadata and controls
51 lines (40 loc) · 1.42 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
;compile this program to:
; - assets/mixperfect_upgrader
; - assets/mixperfect_upgrader.exe
EnableExplicit
Procedure.s OSPath(Path.s)
CompilerIf #PB_Compiler_OS = #PB_OS_Linux
ProcedureReturn ReplaceString(Path, "\", "/")
CompilerEndIf
ProcedureReturn ReplaceString(Path, "/", "\")
EndProcedure
Define.s DownloadFile = Trim(ProgramParameter(1))
Define.s ProgramFile = Trim(ProgramParameter(2))
If ProgramParameter(0) <> "upgrade" Or CountProgramParameters() <> 3
MessageRequester("MixPerfect Upgrader", "This program is ment to be run internally by MixPerfect Player", #PB_MessageRequester_Error)
End
EndIf
Define.s Source = OSPath(GetPathPart(ProgramFilename()) + "/" + DownloadFile)
Define.s Destination = OSPath(GetPathPart(ProgramFilename()) + "/_" + DownloadFile)
If FileSize(Destination) <> -1
DeleteFile(Destination)
EndIf
If RenameFile(Source, Destination)
;hier moet het main programma eerst worden afgesloten
Delay(1000)
If CopyFile(Destination, ProgramFile)
DeleteFile(Destination)
CompilerIf #PB_Compiler_OS = #PB_OS_Linux
RunProgram("chmod", "+x " + ProgramFile, "", #PB_Program_Wait)
CompilerEndIf
;main programma opstarten
RunProgram(ProgramFile, "upgraded", "")
EndIf
EndIf
; IDE Options = PureBasic 6.11 LTS (Linux - x64)
; CursorPosition = 41
; Folding = -
; EnableXP
; DPIAware
; Executable = assets/mixperfect_upgrader
; DisableDebugger