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
outfile := lite-xl
compiler := gcc-11
cxxcompiler := g++-11
compiler := gcc
cxxcompiler := g++
INCPATH := -Isrc -I/sdk/local/newlib/include/SDL2 \
-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
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)
CFLAGS += -g -gstabs

View File

@ -223,6 +223,23 @@ https://git.walkero.gr/walkero/lite-xl/issues
# 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
### Added
- 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
-- in project scan or falsy if it shouldn't appear in the list.
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
-- a directory, for example for /dev/* entries on linux.
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 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
local entries = { }
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.
-- The field item.topdir will identify it as a top level directory.
path = common.normalize_volume(path)
local topdir = {
name = path,
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
PATHSEP = package.config:sub(1, 1)
EXEDIR = EXEFILE:match("^(.+)[/\\][^/\\]+$")
EXEDIR = EXEFILE:match("^(.+)[:/\\][^/\\]+$")
if MACOS_RESOURCES then
DATADIR = MACOS_RESOURCES
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')
end
USERDIR = (system.get_file_info(EXEDIR .. PATHSEP .. 'user') and (EXEDIR .. PATHSEP .. 'user'))
or os.getenv("LITE_USERDIR")
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)
if PLATFORM == "Windows" then
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))
elseif PLATFORM == "Linux" or string.find(PLATFORM, "BSD") then
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
})
@ -802,8 +804,8 @@ if projectsearch then
menu:register(function()
local item = treeitem()
return item and item.type == "dir"
end, {
{ text = "Find in directory", command = "treeview:search-in-directory" }
end, {
{ text = "Find in directory", command = "treeview:search-in-directory" }
})
command.add(function()
return view.hovered_item and view.hovered_item.type == "dir"

View File

@ -876,6 +876,13 @@ static int f_exec(lua_State *L) {
#if _WIN32
sprintf(buf, "cmd /c \"%s\"", cmd);
WinExec(buf, SW_HIDE);
#elif defined(__amigaos4__)
SystemTags( cmd,
SYS_Input, ZERO,
SYS_Output, NULL,
SYS_Error, ZERO,
SYS_Asynch, TRUE,
TAG_DONE);
#else
sprintf(buf, "%s &", cmd);
int res = system(buf);
@ -1006,7 +1013,7 @@ static int f_library_gc(lua_State *L) {
lua_getfield(L, 1, "handle");
void* handle = lua_touserdata(L, -1);
SDL_UnloadObject(handle);
return 0;
}
@ -1180,7 +1187,7 @@ static const luaL_Reg lib[] = {
int luaopen_system(lua_State *L) {
luaL_newmetatable(L, API_TYPE_NATIVE_PLUGIN);
luaL_newmetatable(L, API_TYPE_NATIVE_PLUGIN);
lua_pushcfunction(L, f_library_gc);
lua_setfield(L, -2, "__gc");
luaL_newlib(L, lib);

View File

@ -273,7 +273,7 @@ init_lua:
" error_dir=USERDIR\n"
" pcall(core.on_error, err)\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"
" fp:write('Error: ' .. tostring(err) .. '\\n')\n"
" fp:write(debug.traceback(nil, 4)..'\\n')\n"