Mercurial Hosting > editor
changeset 52:3f4c3722b78b
.luan_editor dir
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 24 May 2025 16:25:55 -0600 |
parents | 32631fdbbdf1 |
children | d5681da8ece8 |
files | dev.sh scripts/install.sh src/luan_editor/window.luan |
diffstat | 3 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/dev.sh Sat May 24 11:31:09 2025 -0600 +++ b/dev.sh Sat May 24 16:25:55 2025 -0600 @@ -8,4 +8,6 @@ . luan string: CLASSPATH=$CLASSPATH:$EDITOR_HOME/lib/jortho.jar:$EDITOR_HOME/src +mkdir -p ~/.luan_editor + java -Xdock:name="Luan Editor" -classpath $CLASSPATH luan.Luan classpath:luan_editor/editor.luan "$@" 2>&1 | grep --line-buffered -v 'NSRemoteView\|NSSavePanel' | tee err
--- a/scripts/install.sh Sat May 24 11:31:09 2025 -0600 +++ b/scripts/install.sh Sat May 24 16:25:55 2025 -0600 @@ -14,9 +14,11 @@ for i in $(pwd)/jars/* ; do CLASSPATH=\$CLASSPATH:\$i ; done CLASSPATH=\$(echo -n \$CLASSPATH | sed 's/^://') +mkdir -p ~/.luan_editor + set +m -java -Xdock:name="Luan Editor" -classpath \$CLASSPATH luan.Luan classpath:luan_editor/editor.luan "\$@" 2>&1 | grep --line-buffered -v 'NSRemoteView\|NSSavePanel' & +java -Xdock:name="Luan Editor" -classpath \$CLASSPATH luan.Luan classpath:luan_editor/editor.luan "\$@" 2>&1 | grep --line-buffered -v 'NSRemoteView\|NSSavePanel' | tee ~/.luan_editor/error.log & End chmod +x /usr/local/bin/luan_editor
--- a/src/luan_editor/window.luan Sat May 24 11:31:09 2025 -0600 +++ b/src/luan_editor/window.luan Sat May 24 16:25:55 2025 -0600 @@ -1,6 +1,9 @@ local Luan = require "luan:Luan.luan" local error = Luan.error local stringify = Luan.stringify or error() +local Parsers = require "luan:Parsers.luan" +local json_string = Parsers.json_string or error() +local json_parse = Parsers.json_parse or error() local Math = require "luan:Math.luan" local min = Math.min or error() local String = require "luan:String.luan" @@ -44,11 +47,11 @@ end end -local config_file = Io.uri("file:"..Swing.home_dir.."/.luan_editor") +local config_file = Io.uri("file:"..Swing.home_dir.."/.luan_editor/config.json") local config = {} if config_file.exists() then try - config = Luan.parse(config_file.read_text()) + config = json_parse(config_file.read_text()) catch e logger.error(e) end @@ -61,7 +64,7 @@ config.list_window.size = config.list_window.size or { width=200, height=400 } local function save_config() - config_file.write_text( stringify(config).."\n" ) + config_file.write_text( json_string(config).."\n" ) end local list_view = new_list{