Mercurial Hosting > editor
view src/luan_editor/editor.luan @ 59:824f6d74b1d4
use launcher
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 04 Jun 2025 18:21:45 -0600 |
parents | 6059b4e22d47 |
children |
line wrap: on
line source
local Luan = require "luan:Luan.luan" local error = Luan.error local ipairs = Luan.ipairs or error() local stringify = Luan.stringify or error() local String = require "luan:String.luan" local to_number = String.to_number or error() local Io = require "luan:Io.luan" local new_file = Io.schemes.file or error() local Launcher = require "luan:swing/Launcher.luan" local Java = require "classpath:luan_editor/Java.luan" local Logging = require "luan:logging/Logging.luan" local logger = Logging.logger "editor/editor" local function open(args) local Window = require "classpath:luan_editor/Window.luan" local new_window = Window.new_window or error() if #args == 0 then new_window() else for _, arg in ipairs(args) do local file = new_file(arg) new_window(file) end end end local function reopen(args) local Window = require "classpath:luan_editor/Window.luan" local open_windows = Window.open_windows or error() open_windows(args) end local port = Java.port if port ~= nil then Launcher.port = to_number(port) or error("bad port: "..port) end local args = {nil} for _, arg in ipairs(Luan.arg) do local file = new_file(arg) file = file.canonical().to_string() args[#args+1] = file end Launcher.launch(open,reopen,args)