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 29 let app = App "Editor" 30 is_resizable = true 31 32 let config = load_config 33 let crate_name = config["crate"] 34 publish@ fields@ app.dependencies 35 let editor = Editor 36 =app =crate_name =crates_path =develop_path 37 target_path = "$develop_path/cpptest" 38 39 load_crate crate_name editor 40 app.run 41