-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApp.xojo_code
More file actions
95 lines (72 loc) · 3.21 KB
/
App.xojo_code
File metadata and controls
95 lines (72 loc) · 3.21 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#tag Class
Protected Class App
Inherits Application
#tag Event
Sub Open()
// The file menu is empty on the Mac, so hide it
#if targetMacOS
FileMenu.visible = false
#endif
pPreferences = new Dictionary()
dim xPlanePath as String
if (pPreferences.hasKey("XPlanePath")) then xPlanePath = pPreferences.value("XPlanePath")
if (xPlanePath <> "") then pXPlaneFolder = getFolderItem(xPlanePath, FolderItem.PathTypeAbsolute)
if (pXPlaneFolder = nil or not pXPlaneFolder.exists() or not pXPlaneFolder.directory) then
dim result as Boolean = getXPlaneFolder(true)
end if
End Sub
#tag EndEvent
#tag Method, Flags = &h0
Function getXPlaneFolder(require as Boolean) As boolean
// Returns true if the user chose a new folder (and require is false)
dim dialog as SelectFolderDialog = new SelectFolderDialog()
dim xPlanePath as String
dim xPlaneFolder as FolderItem
dialog.title = "Please locate the OpenSceneryX folder BEFORE PACKAGING"
dialog.promptText = "Please locate the OpenSceneryX folder BEFORE PACKAGING"
xPlaneFolder = dialog.showModal()
if (xPlaneFolder = nil) then
if (require) then
msgBox("This installer cannot work without an OpenSceneryX folder and will now quit.")
quit
else
return false
end if
end if
pXPlaneFolder = xPlaneFolder
pPreferences.value("XPlanePath") = pXPlaneFolder.nativePath
return true
End Function
#tag EndMethod
#tag Property, Flags = &h21
Private pPreferences As Dictionary
#tag EndProperty
#tag Property, Flags = &h0
pXPlaneFolder As FolderItem
#tag EndProperty
#tag Constant, Name = kApplicationName, Type = String, Dynamic = False, Default = \"OpenSceneryX Installer", Scope = Public
#tag EndConstant
#tag Constant, Name = kEditClear, Type = String, Dynamic = False, Default = \"&Delete", Scope = Public
#Tag Instance, Platform = Windows, Language = Default, Definition = \"&Delete"
#Tag Instance, Platform = Linux, Language = Default, Definition = \"&Delete"
#tag EndConstant
#tag Constant, Name = kFileQuit, Type = String, Dynamic = False, Default = \"&Quit", Scope = Public
#Tag Instance, Platform = Windows, Language = Default, Definition = \"E&xit"
#tag EndConstant
#tag Constant, Name = kFileQuitShortcut, Type = String, Dynamic = False, Default = \"", Scope = Public
#Tag Instance, Platform = Mac OS, Language = Default, Definition = \"Cmd+Q"
#Tag Instance, Platform = Linux, Language = Default, Definition = \"Ctrl+Q"
#tag EndConstant
#tag Constant, Name = kPathSeparator, Type = String, Dynamic = False, Default = \"", Scope = Public
#Tag Instance, Platform = Mac OS, Language = Default, Definition = \"/"
#Tag Instance, Platform = Windows, Language = Default, Definition = \"\\"
#Tag Instance, Platform = Linux, Language = Default, Definition = \"/"
#tag EndConstant
#tag Constant, Name = kServerURL, Type = String, Dynamic = False, Default = \"127.0.0.1/opensceneryx", Scope = Public
#tag EndConstant
#tag Constant, Name = kServerURLLive, Type = String, Dynamic = False, Default = \"www.opensceneryx.com", Scope = Public
#tag EndConstant
#tag ViewBehavior
#tag EndViewBehavior
End Class
#tag EndClass