Paths fixes, Open in System changes and a few others done

This commit is contained in:
George Sokianos 2024-02-11 22:11:30 +00:00
parent ad4c221dd8
commit df8eaa64d1
8 changed files with 53 additions and 13 deletions

View File

@ -12,8 +12,8 @@ LiteXL_OBJ := \
src/api/dirmonitor/os4.o src/platform/codesets.o src/api/dirmonitor/os4.o src/platform/codesets.o
outfile := lite-xl outfile := lite-xl
compiler := gcc-11 compiler := gcc
cxxcompiler := g++-11 cxxcompiler := g++
INCPATH := -Isrc -I/sdk/local/newlib/include/SDL2 \ INCPATH := -Isrc -I/sdk/local/newlib/include/SDL2 \
-I/sdk/local/common/include/lua54 -I/sdk/local/common/include/freetype2 -I/sdk/local/common/include/lua54 -I/sdk/local/common/include/freetype2
@ -23,7 +23,7 @@ DFLAGS += -D__USE_INLINE__ -DLITE_XL_DATA_USE_EXEDIR
CFLAGS += -Werror -Wwrite-strings -O3 -std=gnu11 -fno-strict-aliasing CFLAGS += -Werror -Wwrite-strings -O3 -std=gnu11 -fno-strict-aliasing
LFLAGS += -mcrt=newlib \ LFLAGS += -mcrt=newlib \
-lpcre2 -lSDL2 -llua54 -lfreetype -lpng -lz -lpthread -athread=native -lpcre2-8 -lSDL2 -llua54 -lfreetype -lpng -lz -lpthread -athread=native
ifeq ($(DEBUG),1) ifeq ($(DEBUG),1)
CFLAGS += -g -gstabs CFLAGS += -g -gstabs

View File

@ -223,6 +223,23 @@ https://git.walkero.gr/walkero/lite-xl/issues
# Changelog # Changelog
## [2.1.2r1] - future
### Updated
- Updated the code to the upstream 2.1.3 release
- Compiled with SDL 2.30.x that supports writing in ISO encodings, other
than English. Now the editor should be able to support any language
and in conjuction with the codesets plugin be able to make text
encodings conversions (AmigsOS 4 version only)
### Changed
- Changed the way the "Open in system" option executes the WBRun command
in AmigaOS 4, with a more secure way
- Did a lot of code cleanup in sync with the upstream, and parts that
were left over
### Fixed
- Fixed opening partition and assign paths
## [2.1.2r1] - 2023-12-19 ## [2.1.2r1] - 2023-12-19
### Added ### Added
- Added the new experimental codesets plugin (AmigaOS4 version only). - Added the new experimental codesets plugin (AmigaOS4 version only).

View File

@ -177,7 +177,13 @@ end
-- compute a file's info entry completed with "filename" to be used -- compute a file's info entry completed with "filename" to be used
-- in project scan or falsy if it shouldn't appear in the list. -- in project scan or falsy if it shouldn't appear in the list.
local function get_project_file_info(root, file, ignore_compiled) local function get_project_file_info(root, file, ignore_compiled)
local info = system.get_file_info(root .. PATHSEP .. file) local info
if (PLATFORM == "AmigaOS 4" or PLATFORM == "MorphOS") and (string.sub(root, -1) == ":") then
info = system.get_file_info(root .. file)
else
info = system.get_file_info(root .. PATHSEP .. file)
end
-- info can be not nil but info.type may be nil if is neither a file neither -- info can be not nil but info.type may be nil if is neither a file neither
-- a directory, for example for /dev/* entries on linux. -- a directory, for example for /dev/* entries on linux.
if info and info.type then if info and info.type then
@ -200,7 +206,13 @@ function dirwatch.get_directory_files(dir, root, path, entries_count, recurse_pr
local t0 = system.get_time() local t0 = system.get_time()
local ignore_compiled = compile_ignore_files() local ignore_compiled = compile_ignore_files()
local all = system.list_dir(root .. PATHSEP .. path) local all
if (PLATFORM == "AmigaOS 4" or PLATFORM == "MorphOS") and (string.sub(root, -1) == ":") then
all = system.list_dir(root .. path)
else
all = system.list_dir(root .. PATHSEP .. path)
end
if not all then return nil end if not all then return nil end
local entries = { } local entries = { }
for _, file in ipairs(all) do for _, file in ipairs(all) do

View File

@ -250,6 +250,7 @@ function core.add_project_directory(path)
-- will be simply the name of the directory, without its path. -- will be simply the name of the directory, without its path.
-- The field item.topdir will identify it as a top level directory. -- The field item.topdir will identify it as a top level directory.
path = common.normalize_volume(path) path = common.normalize_volume(path)
local topdir = { local topdir = {
name = path, name = path,
item = {filename = common.basename(path), type = "dir", topdir = true}, item = {filename = common.basename(path), type = "dir", topdir = true},

View File

@ -5,13 +5,14 @@ MOD_VERSION = "3"
SCALE = tonumber(os.getenv("LITE_SCALE") or os.getenv("GDK_SCALE") or os.getenv("QT_SCALE_FACTOR")) or 1 SCALE = tonumber(os.getenv("LITE_SCALE") or os.getenv("GDK_SCALE") or os.getenv("QT_SCALE_FACTOR")) or 1
PATHSEP = package.config:sub(1, 1) PATHSEP = package.config:sub(1, 1)
EXEDIR = EXEFILE:match("^(.+)[/\\][^/\\]+$") EXEDIR = EXEFILE:match("^(.+)[:/\\][^/\\]+$")
if MACOS_RESOURCES then if MACOS_RESOURCES then
DATADIR = MACOS_RESOURCES DATADIR = MACOS_RESOURCES
else else
local prefix = os.getenv('LITE_PREFIX') or EXEDIR:match("^(.+)[/\\]bin$") local prefix = os.getenv('LITE_PREFIX') or EXEDIR:match("^(.+)[:/\\]bin$")
DATADIR = prefix and (prefix .. PATHSEP .. 'share' .. PATHSEP .. 'lite-xl') or (EXEDIR .. PATHSEP .. 'data') DATADIR = prefix and (prefix .. PATHSEP .. 'share' .. PATHSEP .. 'lite-xl') or (EXEDIR .. PATHSEP .. 'data')
end end
USERDIR = (system.get_file_info(EXEDIR .. PATHSEP .. 'user') and (EXEDIR .. PATHSEP .. 'user')) USERDIR = (system.get_file_info(EXEDIR .. PATHSEP .. 'user') and (EXEDIR .. PATHSEP .. 'user'))
or os.getenv("LITE_USERDIR") or os.getenv("LITE_USERDIR")
or ((os.getenv("XDG_CONFIG_HOME") and os.getenv("XDG_CONFIG_HOME") .. PATHSEP .. "lite-xl")) or ((os.getenv("XDG_CONFIG_HOME") and os.getenv("XDG_CONFIG_HOME") .. PATHSEP .. "lite-xl"))

View File

@ -789,10 +789,12 @@ command.add(
["treeview:open-in-system"] = function(item) ["treeview:open-in-system"] = function(item)
if PLATFORM == "Windows" then if PLATFORM == "Windows" then
system.exec(string.format("start \"\" %q", item.abs_filename)) system.exec(string.format("start \"\" %q", item.abs_filename))
elseif string.find(PLATFORM, "Mac") then elseif string.find(PLATFORM, "Mac") or PLATFORM == "MorphOS" then
system.exec(string.format("open %q", item.abs_filename)) system.exec(string.format("open %q", item.abs_filename))
elseif PLATFORM == "Linux" or string.find(PLATFORM, "BSD") then elseif PLATFORM == "Linux" or string.find(PLATFORM, "BSD") then
system.exec(string.format("xdg-open %q", item.abs_filename)) system.exec(string.format("xdg-open %q", item.abs_filename))
elseif PLATFORM == "AmigaOS 4" then
system.exec(string.format("WBRUN %q SHOW=all VIEWBY=name", item.abs_filename))
end end
end end
}) })

View File

@ -876,6 +876,13 @@ static int f_exec(lua_State *L) {
#if _WIN32 #if _WIN32
sprintf(buf, "cmd /c \"%s\"", cmd); sprintf(buf, "cmd /c \"%s\"", cmd);
WinExec(buf, SW_HIDE); WinExec(buf, SW_HIDE);
#elif defined(__amigaos4__)
SystemTags( cmd,
SYS_Input, ZERO,
SYS_Output, NULL,
SYS_Error, ZERO,
SYS_Asynch, TRUE,
TAG_DONE);
#else #else
sprintf(buf, "%s &", cmd); sprintf(buf, "%s &", cmd);
int res = system(buf); int res = system(buf);

View File

@ -273,7 +273,7 @@ init_lua:
" error_dir=USERDIR\n" " error_dir=USERDIR\n"
" pcall(core.on_error, err)\n" " pcall(core.on_error, err)\n"
" else\n" " else\n"
" error_dir=system.absolute_path('.')\n" " error_dir=system.absolute_path(error_dir)\n"
" local fp = io.open('error.txt', 'wb')\n" " local fp = io.open('error.txt', 'wb')\n"
" fp:write('Error: ' .. tostring(err) .. '\\n')\n" " fp:write('Error: ' .. tostring(err) .. '\\n')\n"
" fp:write(debug.traceback(nil, 4)..'\\n')\n" " fp:write(debug.traceback(nil, 4)..'\\n')\n"