Added ability to open files with drag 'n drop

This commit is contained in:
George Sokianos 2024-03-18 23:06:01 +00:00
parent 9944a91f55
commit 79f42686a7
6 changed files with 43 additions and 4 deletions

View File

@ -230,6 +230,14 @@ https://git.walkero.gr/walkero/lite-xl/issues
# Changelog # Changelog
## [2.1.3r2] - future
### Added
- Added the ability to open files and folders by drag 'n drop them on the
LiteXL icon when this is on the AmiDock
### Fixed
- Fix opening files from the root of a device
## [2.1.3r1] - 2024-03-09 ## [2.1.3r1] - 2024-03-09
### Added ### Added
- Added AmiUpdate support - Added AmiUpdate support

View File

@ -714,7 +714,7 @@ function core.init()
local file_abs = core.project_absolute_path(arg_filename) local file_abs = core.project_absolute_path(arg_filename)
if file_abs then if file_abs then
table.insert(files, file_abs) table.insert(files, file_abs)
project_dir = file_abs:match("^(.+)[/\\].+$") project_dir = file_abs:match("^(.+)[:/\\].+$")
end end
end end
end end

View File

@ -1,5 +1,5 @@
-- this file is used by lite-xl to setup the Lua environment when starting -- this file is used by lite-xl to setup the Lua environment when starting
VERSION = "2.1.3r1" VERSION = "2.1.3r2"
MOD_VERSION = "3" 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

View File

@ -8,7 +8,7 @@
#include <signal.h> #include <signal.h>
#if defined(__amigaos4__) || defined(__morphos__) #if defined(__amigaos4__) || defined(__morphos__)
#define VSTRING "Lite XL 2.1.3r1 (09.03.2024)" #define VSTRING "Lite XL 2.1.3r2 (18.03.2024)"
#define VERSTAG "\0$VER: " VSTRING #define VERSTAG "\0$VER: " VSTRING
#endif #endif
@ -20,6 +20,7 @@
#include <mach-o/dyld.h> #include <mach-o/dyld.h>
#elif defined(__amigaos4__) #elif defined(__amigaos4__)
#include <locale.h> #include <locale.h>
#include <workbench/startup.h>
#include "platform/codesets.h" #include "platform/codesets.h"
#include "platform/amigaos4.h" #include "platform/amigaos4.h"
static CONST_STRPTR stack USED = "$STACK:102400"; static CONST_STRPTR stack USED = "$STACK:102400";
@ -223,6 +224,27 @@ init_lua:
lua_pushstring(L, argv[i]); lua_pushstring(L, argv[i]);
lua_rawseti(L, -2, i + 1); lua_rawseti(L, -2, i + 1);
} }
#if defined(__amigaos4__)
if (!argc)
{
struct WBStartup *wbs = (struct WBStartup *)argv;
if (wbs->sm_NumArgs > 1)
{
char result[MAX_DOS_PATH];
for (int i = 0; i < wbs->sm_NumArgs; i++) {
getFullPathFromLock(wbs->sm_ArgList[i].wa_Lock, result);
if (result[strlen(result) -1] == ':')
strcat(result, wbs->sm_ArgList[i].wa_Name);
else
sprintf(result, "%s/%s", result, wbs->sm_ArgList[i].wa_Name);
lua_pushstring(L, result);
lua_rawseti(L, -2, i + 1);
}
}
}
#endif
lua_setglobal(L, "ARGS"); lua_setglobal(L, "ARGS");
lua_pushstring(L, SDL_GetPlatform()); lua_pushstring(L, SDL_GetPlatform());

View File

@ -70,3 +70,12 @@ char *_fullpath(const char *path)
return NULL; return NULL;
} }
void getFullPathFromLock(BPTR lock, char *result)
{
if (lock)
{
DevNameFromLock(lock, result, MAX_DOS_PATH, DN_FULLPATH);
return;
}
}

View File

@ -6,6 +6,6 @@
char *_fullpath(const char *); char *_fullpath(const char *);
void getFullPathFromLock(BPTR, char *);
#endif #endif