From d74688028cf81ad3cca4439721f2195d2715c641 Mon Sep 17 00:00:00 2001 From: George Sokianos Date: Thu, 23 May 2024 19:39:06 +0100 Subject: [PATCH] Did all the fixes to have dragndrop work on MOS --- Makefile.mos | 4 ++-- README_Amiga.md | 4 ++-- src/main.c | 7 ++++--- src/platform/morphos.c | 10 +++++++++- src/platform/morphos.h | 3 +++ 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Makefile.mos b/Makefile.mos index e2e414a0..b05074ba 100644 --- a/Makefile.mos +++ b/Makefile.mos @@ -43,7 +43,7 @@ LiteXL: $(LiteXL_OBJ) $(compiler) -c $< -o $*.o $(CFLAGS) $(INCPATH) $(DFLAGS) src/main.o: src/main.c src/api/api.h src/rencache.h \ - src/renderer.h src/platform/morphos.h + src/renderer.h src/platform/morphos.h src/platform/codesets.h src/rencache.o: src/rencache.c @@ -57,7 +57,7 @@ src/api/regex.o: src/api/regex.c src/api/renderer.o: src/api/renderer.c -src/api/system.o: src/api/system.c +src/api/system.o: src/api/system.c src/platform/morphos.h src/platform/morphos.o: src/platform/morphos.c diff --git a/README_Amiga.md b/README_Amiga.md index 0b2d47ee..39a008d1 100644 --- a/README_Amiga.md +++ b/README_Amiga.md @@ -230,10 +230,10 @@ https://git.walkero.gr/walkero/lite-xl/issues # Changelog -## [2.1.4r1] - future +## [2.1.4r1] - 2024-05-23 ### Added - Added the ability to open files and folders by drag 'n drop them on the - LiteXL icon when this is on the AmiDock + LiteXL icon when this is on the AmiDock (AmigaOS4) / Panel (MorphOS) ### Updated - Updated the code to the upstream 2.1.4 release diff --git a/src/main.c b/src/main.c index 3831009c..7862bae4 100644 --- a/src/main.c +++ b/src/main.c @@ -8,7 +8,7 @@ #include #if defined(__amigaos4__) || defined(__morphos__) -#define VSTRING "Lite XL 2.1.3r2 (18.03.2024)" +#define VSTRING "Lite XL 2.1.4r1 (23.05.2024)" #define VERSTAG "\0$VER: " VSTRING #endif @@ -26,6 +26,7 @@ static CONST_STRPTR stack USED = "$STACK:102400"; static CONST_STRPTR version USED = VERSTAG; #elif defined(__morphos__) + #include #include "platform/codesets.h" #include "platform/morphos.h" unsigned long __stack = 1000000; @@ -224,7 +225,7 @@ init_lua: lua_pushstring(L, argv[i]); lua_rawseti(L, -2, i + 1); } - #if defined(__amigaos4__) + #if defined(__amigaos4__) || defined(__morphos__) if (!argc) { struct WBStartup *wbs = (struct WBStartup *)argv; @@ -233,7 +234,7 @@ init_lua: 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] == ':') + 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); diff --git a/src/platform/morphos.c b/src/platform/morphos.c index a88bdece..fee151f1 100644 --- a/src/platform/morphos.c +++ b/src/platform/morphos.c @@ -4,7 +4,6 @@ #include #include "morphos.h" -#define MAX_DOS_NAME FILENAME_MAX static BOOL getFullPath(const char *path, char *result) { @@ -65,3 +64,12 @@ char *_fullpath(const char *path) return NULL; } + +void getFullPathFromLock(BPTR lock, char *result) +{ + if (lock) + { + NameFromLock(lock, result, MAX_DOS_PATH); + return; + } +} diff --git a/src/platform/morphos.h b/src/platform/morphos.h index 63434aea..95b3edd7 100755 --- a/src/platform/morphos.h +++ b/src/platform/morphos.h @@ -5,6 +5,9 @@ #include #include +#define MAX_DOS_NAME FILENAME_MAX +#define MAX_DOS_PATH 4000 + char *_fullpath(const char *); #endif