From 3109a33fc01b3ab05c5ea7ce7dd6cd1665227fa1 Mon Sep 17 00:00:00 2001 From: chrisws Date: Fri, 3 Jun 2022 20:30:42 +1000 Subject: [PATCH 1/5] Fix to allow module access from inside packaged AppImage --- src/common/plugins.c | 7 +++++++ src/platform/console/Makefile.am | 5 +++++ src/platform/console/smallbasic.desktop | 9 +++++++++ 3 files changed, 21 insertions(+) create mode 100644 src/platform/console/smallbasic.desktop diff --git a/src/common/plugins.c b/src/common/plugins.c index b97452e0..0cb7a44f 100644 --- a/src/common/plugins.c +++ b/src/common/plugins.c @@ -210,6 +210,13 @@ static int slib_find_path(char *path, const char *file) { result = sys_search_path(rel_path, file, path); } } + // find in AppImage + if (!result && getenv("APPDIR")) { + char rel_path[PATH_SIZE]; + strlcpy(rel_path, getenv("APPDIR"), PATH_SIZE); + strlcat(rel_path, "/usr/lib", PATH_SIZE); + result = sys_search_path(rel_path, file, path); + } // find in modpath if (!result && opt_modpath[0]) { result = sys_search_path(opt_modpath, file, path); diff --git a/src/platform/console/Makefile.am b/src/platform/console/Makefile.am index e522d821..a15d3b30 100644 --- a/src/platform/console/Makefile.am +++ b/src/platform/console/Makefile.am @@ -25,6 +25,11 @@ endif sbasic_DEPENDENCIES = $(top_srcdir)/src/common/libsb_common.a +iconsdir = $(datadir)/icons/hicolor/128x128/apps +icons_DATA = ../../../images/sb-desktop-128x128.png +desktopdir = $(datadir)/applications +desktop_DATA = smallbasic.desktop + TEST_DIR=../../../samples/distro-examples/tests UNIT_TESTS=array break byref eval-test iifs matrices metaa ongoto \ uds hash pass1 call_tau short-circuit strings stack-test \ diff --git a/src/platform/console/smallbasic.desktop b/src/platform/console/smallbasic.desktop new file mode 100644 index 00000000..2a9a8b42 --- /dev/null +++ b/src/platform/console/smallbasic.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=SmallBASIC +Exec=sbasic +Icon=sb-desktop-128x128 +Terminal=false +Type=Application +Categories=Development; +MimeType=application/bas +NoDisplay=false From 2744f389af709a24d197c7406812541bbd4b4489 Mon Sep 17 00:00:00 2001 From: chrisws Date: Fri, 3 Jun 2022 20:31:23 +1000 Subject: [PATCH 2/5] ANDROID: Fix NPE android issue --- .../src/main/java/net/sourceforge/smallbasic/MainActivity.java | 2 +- src/platform/android/jni/display.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platform/android/app/src/main/java/net/sourceforge/smallbasic/MainActivity.java b/src/platform/android/app/src/main/java/net/sourceforge/smallbasic/MainActivity.java index 0519dc3b..a2463672 100644 --- a/src/platform/android/app/src/main/java/net/sourceforge/smallbasic/MainActivity.java +++ b/src/platform/android/app/src/main/java/net/sourceforge/smallbasic/MainActivity.java @@ -792,7 +792,7 @@ private String getExternalStorage() { } else if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // https://commonsware.com/blog/2019/06/07/death-external-storage-end-saga.html File[] dirs = getExternalMediaDirs(); - result = dirs[0].getAbsolutePath(); + result = dirs != null && dirs.length > 0 ? dirs[0].getAbsolutePath() : getInternalStorage(); } else { result = getInternalStorage(); } diff --git a/src/platform/android/jni/display.cpp b/src/platform/android/jni/display.cpp index f5d2447f..511d9e03 100644 --- a/src/platform/android/jni/display.cpp +++ b/src/platform/android/jni/display.cpp @@ -86,7 +86,7 @@ void Canvas::fillRect(int left, int top, int width, int height, pixel_t drawColo break; } else if (posY >= dtY) { pixel_t *line = getLine(posY); - for (int x = 0; x < width; x++) { + for (int x = 0; x < width && line; x++) { int posX = x + left; if (posX == _w) { break; From a323930b98560c54dc25fc8af5688e3f17d939d3 Mon Sep 17 00:00:00 2001 From: chrisws Date: Sat, 4 Jun 2022 18:13:25 +1000 Subject: [PATCH 3/5] CONSOLE: updated for building as AppImage --- src/platform/console/smallbasic.appdata.xml | 27 +++++++++++++++++++++ src/platform/console/smallbasic.desktop | 4 +-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 src/platform/console/smallbasic.appdata.xml diff --git a/src/platform/console/smallbasic.appdata.xml b/src/platform/console/smallbasic.appdata.xml new file mode 100644 index 00000000..d5a2e696 --- /dev/null +++ b/src/platform/console/smallbasic.appdata.xml @@ -0,0 +1,27 @@ + + + smallbasic + SmallBASIC + SmallBASIC is a fast and easy to learn BASIC language interpreter ideal for everyday calculations, scripts and prototypes + MIT + GPL-2.0-or-later + +

+ SmallBASIC is a fast and easy to learn BASIC language interpreter ideal for everyday calculations, scripts and prototypes. + SmallBASIC includes trigonometric, matrices and algebra functions, a built in IDE, a powerful string library, system, + sound, and graphic commands along with structured programming syntax. SmallBASIC is licensed under the GPL. +

+
+ smallbasic.desktop + + + https://smallbasic.github.io/images/screenshots/gold.png + + + https://smallbasic.github.io/images/screenshots/bowling.png + + + https://smallbasic.github.io/images/screenshots/bb.gif + + +
diff --git a/src/platform/console/smallbasic.desktop b/src/platform/console/smallbasic.desktop index 2a9a8b42..cc19675d 100644 --- a/src/platform/console/smallbasic.desktop +++ b/src/platform/console/smallbasic.desktop @@ -2,8 +2,8 @@ Name=SmallBASIC Exec=sbasic Icon=sb-desktop-128x128 -Terminal=false +Terminal=true Type=Application -Categories=Development; +Categories=Development MimeType=application/bas NoDisplay=false From 8beaad321470b743a8ef1fd2fe7781bdafc2927c Mon Sep 17 00:00:00 2001 From: chrisws Date: Sat, 4 Jun 2022 21:01:16 +1000 Subject: [PATCH 4/5] CONSOLE: updated for building as AppImage --- src/platform/console/Makefile.am | 2 +- ...mallbasic.appdata.xml => io.github.smallbasic.appdata.xml} | 4 ++-- .../{smallbasic.desktop => io.github.smallbasic.desktop} | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) rename src/platform/console/{smallbasic.appdata.xml => io.github.smallbasic.appdata.xml} (91%) rename src/platform/console/{smallbasic.desktop => io.github.smallbasic.desktop} (99%) diff --git a/src/platform/console/Makefile.am b/src/platform/console/Makefile.am index a15d3b30..6f42ab74 100644 --- a/src/platform/console/Makefile.am +++ b/src/platform/console/Makefile.am @@ -28,7 +28,7 @@ sbasic_DEPENDENCIES = $(top_srcdir)/src/common/libsb_common.a iconsdir = $(datadir)/icons/hicolor/128x128/apps icons_DATA = ../../../images/sb-desktop-128x128.png desktopdir = $(datadir)/applications -desktop_DATA = smallbasic.desktop +desktop_DATA = io.github.smallbasic.desktop TEST_DIR=../../../samples/distro-examples/tests UNIT_TESTS=array break byref eval-test iifs matrices metaa ongoto \ diff --git a/src/platform/console/smallbasic.appdata.xml b/src/platform/console/io.github.smallbasic.appdata.xml similarity index 91% rename from src/platform/console/smallbasic.appdata.xml rename to src/platform/console/io.github.smallbasic.appdata.xml index d5a2e696..4a517506 100644 --- a/src/platform/console/smallbasic.appdata.xml +++ b/src/platform/console/io.github.smallbasic.appdata.xml @@ -1,6 +1,6 @@ - smallbasic + io.github.smallbasic SmallBASIC SmallBASIC is a fast and easy to learn BASIC language interpreter ideal for everyday calculations, scripts and prototypes MIT @@ -12,7 +12,7 @@ sound, and graphic commands along with structured programming syntax. SmallBASIC is licensed under the GPL.

- smallbasic.desktop + io.github.smallbasic.desktop https://smallbasic.github.io/images/screenshots/gold.png diff --git a/src/platform/console/smallbasic.desktop b/src/platform/console/io.github.smallbasic.desktop similarity index 99% rename from src/platform/console/smallbasic.desktop rename to src/platform/console/io.github.smallbasic.desktop index cc19675d..c68e87fa 100644 --- a/src/platform/console/smallbasic.desktop +++ b/src/platform/console/io.github.smallbasic.desktop @@ -7,3 +7,4 @@ Type=Application Categories=Development MimeType=application/bas NoDisplay=false + From b085b21feb27be432bc080900bb525687bbafe1e Mon Sep 17 00:00:00 2001 From: chrisws Date: Sun, 5 Jun 2022 08:30:32 +1000 Subject: [PATCH 5/5] CONSOLE: updated for building as AppImage --- src/platform/console/Makefile.am | 2 +- .../console/io.github.smallbasic.appdata.xml | 7 ++---- src/platform/fltk/Makefile.am | 2 +- .../fltk/io.github.smallbasic.appdata.xml | 24 +++++++++++++++++++ ...c.desktop => io.github.smallbasic.desktop} | 2 +- src/platform/sdl/Makefile.am | 2 +- .../sdl/io.github.smallbasic.appdata.xml | 24 +++++++++++++++++++ ...c.desktop => io.github.smallbasic.desktop} | 2 +- 8 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 src/platform/fltk/io.github.smallbasic.appdata.xml rename src/platform/fltk/{smallbasic.desktop => io.github.smallbasic.desktop} (85%) create mode 100644 src/platform/sdl/io.github.smallbasic.appdata.xml rename src/platform/sdl/{smallbasic.desktop => io.github.smallbasic.desktop} (85%) diff --git a/src/platform/console/Makefile.am b/src/platform/console/Makefile.am index 6f42ab74..f36053d5 100644 --- a/src/platform/console/Makefile.am +++ b/src/platform/console/Makefile.am @@ -1,5 +1,5 @@ # SmallBASIC command line version -# Copyright(C) 2001-2018 Chris Warren-Smith. +# Copyright(C) 2001-2022 Chris Warren-Smith. # # This program is distributed under the terms of the GPL v2.0 or later # Download the GNU Public License (GPL) from www.gnu.org diff --git a/src/platform/console/io.github.smallbasic.appdata.xml b/src/platform/console/io.github.smallbasic.appdata.xml index 4a517506..67e15785 100644 --- a/src/platform/console/io.github.smallbasic.appdata.xml +++ b/src/platform/console/io.github.smallbasic.appdata.xml @@ -15,13 +15,10 @@ io.github.smallbasic.desktop - https://smallbasic.github.io/images/screenshots/gold.png - - - https://smallbasic.github.io/images/screenshots/bowling.png + https://smallbasic.github.io/images/screenshots/sbasic.png - https://smallbasic.github.io/images/screenshots/bb.gif + https://smallbasic.github.io/images/screenshots/gold.png
diff --git a/src/platform/fltk/Makefile.am b/src/platform/fltk/Makefile.am index 1476ea7e..9cd701ac 100644 --- a/src/platform/fltk/Makefile.am +++ b/src/platform/fltk/Makefile.am @@ -49,7 +49,7 @@ sbasici_DEPENDENCIES = $(top_srcdir)/src/common/libsb_common.a iconsdir = $(datadir)/icons/hicolor/128x128/apps icons_DATA = ../../../images/sb-desktop-128x128.png desktopdir = $(datadir)/applications -desktop_DATA = smallbasic.desktop +desktop_DATA = io.github.smallbasic.desktop if WITH_WIN32 sbasici_LDADD += win.res diff --git a/src/platform/fltk/io.github.smallbasic.appdata.xml b/src/platform/fltk/io.github.smallbasic.appdata.xml new file mode 100644 index 00000000..4f9fc8f8 --- /dev/null +++ b/src/platform/fltk/io.github.smallbasic.appdata.xml @@ -0,0 +1,24 @@ + + + io.github.smallbasic + SmallBASIC + SmallBASIC is a fast and easy to learn BASIC language interpreter ideal for everyday calculations, scripts and prototypes + MIT + GPL-2.0-or-later + +

+ SmallBASIC is a fast and easy to learn BASIC language interpreter ideal for everyday calculations, scripts and prototypes. + SmallBASIC includes trigonometric, matrices and algebra functions, a built in IDE, a powerful string library, system, + sound, and graphic commands along with structured programming syntax. SmallBASIC is licensed under the GPL. +

+
+ io.github.smallbasic.desktop + + + https://smallbasic.github.io/images/screenshots/sbasici.png + + + https://smallbasic.github.io/images/screenshots/bb.gif + + +
diff --git a/src/platform/fltk/smallbasic.desktop b/src/platform/fltk/io.github.smallbasic.desktop similarity index 85% rename from src/platform/fltk/smallbasic.desktop rename to src/platform/fltk/io.github.smallbasic.desktop index 0aeacf83..0541b2e3 100644 --- a/src/platform/fltk/smallbasic.desktop +++ b/src/platform/fltk/io.github.smallbasic.desktop @@ -4,6 +4,6 @@ Exec=sbasici Icon=sb-desktop-128x128 Terminal=false Type=Application -Categories=Development; +Categories=Development MimeType=application/bas NoDisplay=false diff --git a/src/platform/sdl/Makefile.am b/src/platform/sdl/Makefile.am index c9456901..84080397 100644 --- a/src/platform/sdl/Makefile.am +++ b/src/platform/sdl/Makefile.am @@ -38,7 +38,7 @@ sbasicg_DEPENDENCIES = $(top_srcdir)/src/common/libsb_common.a iconsdir = $(datadir)/icons/hicolor/128x128/apps icons_DATA = ../../../images/sb-desktop-128x128.png desktopdir = $(datadir)/applications -desktop_DATA = smallbasic.desktop +desktop_DATA = io.github.smallbasic.desktop if WITH_WIN32 sbasicg_LDADD += win.res diff --git a/src/platform/sdl/io.github.smallbasic.appdata.xml b/src/platform/sdl/io.github.smallbasic.appdata.xml new file mode 100644 index 00000000..ae8ea948 --- /dev/null +++ b/src/platform/sdl/io.github.smallbasic.appdata.xml @@ -0,0 +1,24 @@ + + + io.github.smallbasic + SmallBASIC + SmallBASIC is a fast and easy to learn BASIC language interpreter ideal for everyday calculations, scripts and prototypes + MIT + GPL-2.0-or-later + +

+ SmallBASIC is a fast and easy to learn BASIC language interpreter ideal for everyday calculations, scripts and prototypes. + SmallBASIC includes trigonometric, matrices and algebra functions, a built in IDE, a powerful string library, system, + sound, and graphic commands along with structured programming syntax. SmallBASIC is licensed under the GPL. +

+
+ io.github.smallbasic.desktop + + + https://smallbasic.github.io/images/screenshots/sbasicg.png + + + https://smallbasic.github.io/images/screenshots/bowling.png + + +
diff --git a/src/platform/sdl/smallbasic.desktop b/src/platform/sdl/io.github.smallbasic.desktop similarity index 85% rename from src/platform/sdl/smallbasic.desktop rename to src/platform/sdl/io.github.smallbasic.desktop index 9f786f6e..3e42e14b 100644 --- a/src/platform/sdl/smallbasic.desktop +++ b/src/platform/sdl/io.github.smallbasic.desktop @@ -4,6 +4,6 @@ Exec=sbasicg Icon=sb-desktop-128x128 Terminal=false Type=Application -Categories=Development; +Categories=Development MimeType=application/bas NoDisplay=false