Linha de comando: pasta é ignorada com aviso, projeto é aberto

Todo argumento ia para o dlopen como library: abrir o editor com uma pasta
(./TinyBlocks.AppDir) dava "dlopen: ... Is a directory". Agora .so é
library, pasta é ignorada com um aviso claro e qualquer outro arquivo é
aberto como projeto (.json, ou .txt em scratchblocks).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mguinhosandClaude Opus 5.5 committed 2026-10-23 15:55:37 -03:00
1 parent 2a2d22a64a
commit bfa17eecea
15 files changed
+9784 -124

No files matched your search

+7 -4
View File
@@ -35,6 +35,9 @@ static const TbSbContext CX = { s_labels, 2, shape, slot_kind, category, NULL };
static TbBpTab* fresh(void) { return calloc(1, sizeof(TbBpTab)); }
/* a aba tem pool dinamico desde o limite de 65536 blocos */
static void drop(TbBpTab* t) { if (!t) return; tb_blueprint_tab_free(t); free(t); }
static const char* SCRIPT =
"[scratchblocks]\n"
"when flag clicked\n"
@@ -116,7 +119,7 @@ int main(void) {
tb_scratchblocks_import(txt ? txt : "", t2, &CX, warn, sizeof(warn));
char* txt2 = tb_scratchblocks_export(t2, &CX);
CHECK(txt2 && txt && !strcmp(txt, txt2), "ida e volta (exportar(importar(texto))) é estável");
free(txt); free(txt2); free(t2); free(t);
free(txt); free(txt2); drop(t2); drop(t);
/* -- blocos só do TinyBlocks: rótulo em português + ::categoria --- */
t = fresh();
@@ -139,14 +142,14 @@ int main(void) {
CHECK(txt && strstr(txt, "if <[/tmp] é pasta? :: extension> then\n"), "booleano do TinyBlocks dentro do if");
if (txt && !strstr(txt, "if <[/tmp] é pasta? :: extension> then\n")) printf("---- obtido:\n%s----\n", txt);
CHECK(txt && strstr(txt, "forever\n set pen size to (4)\nend\n"), "sempre (tampa) com corpo");
free(txt); free(t);
free(txt); drop(t);
/* -- linha desconhecida: avisa e segue --- */
t = fresh();
n = tb_scratchblocks_import("when flag clicked\nvoe para a lua\nerase all\n", t, &CX, warn, sizeof(warn));
CHECK(n == 1 && strstr(warn, "linha 2"), "linha desconhecida gera aviso com o número da linha");
CHECK(!strcmp(ty(t, t->blocks[t->top[0]].next), "Stage.Clear"), "e o resto continua sendo importado");
free(t);
drop(t);
/* -- texto com colchetes é escapado --- */
t = fresh();
@@ -154,7 +157,7 @@ int main(void) {
CHECK(!strcmp(t->blocks[t->top[0]].in_text[0], "a ] b"), "\\] dentro de [ ] é texto");
txt = tb_scratchblocks_export(t, &CX);
CHECK(txt && !strcmp(txt, "say [a \\] b]\n"), "exporta escapando o ]");
free(txt); free(t);
free(txt); drop(t);
if (fails) printf("\n%d FALHA(S)\n", fails);
else printf("\nTUDO OK\n");