1    let load_config () =
2        let map = Map<String, String>.new
3        let path = "${Sys.executable_directory}/config"
4        let text =
5            if fs/exists path then
6                fs/read_text path
7            else
8                let text = "crate = main\n"
9                fs/write_file path text
10               text
11   
12       let lines = text.lines
13       for line in lines do
14           let index = line.index_of '='
15           let (before, after) = line.split_at index
16           map.add before.trim after.trim
17   
18       map
19   
20   def main =
21       let develop_path @publish =
22           let index = Sys.executable_directory.last_index_of "/develop/"
23           let count = index + "/develop/".length - 1
24           Sys.executable_directory.take count
25   
26       let crates_path @publish = "$develop_path/crates"
27       sys/init_sockets
28       init_glfw
29   
30       let app = App "Editor"
31                     is_resizable = true
32       kd/publish app.dependencies
33                  mode = fields
34   
35       val drawer = Drawer app.os_window
36       kd/publish drawer.dependencies
37                  mode = fields
38   
39       let config = load_config
40       let crate_name = config["crate"]
41       let editor = Editor
42           =app =drawer =crate_name =crates_path =develop_path
43           target_path = "$develop_path/cpptest"
44   
45       load_crate crate_name editor
46       app.run
47