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

+14 -7
View File
@@ -46,7 +46,7 @@ TinyBlocks_JsonValue* tb_blueprint_to_json(const TbBlueprint* bp) {
TinyBlocks_JsonValue* jb = tb_json_array();
PUT(jt, "blocks", jb);
for (int i = 0; i < TB_BP_MAX_WS; i++) {
for (int i = 0; i < T->blocks_n; i++) {
const TbBpBlock* b = &T->blocks[i];
if (!b->used) continue;
TinyBlocks_JsonValue* o = tb_json_object();
@@ -210,8 +210,8 @@ TbBlueprint* tb_blueprint_from_json(const TinyBlocks_JsonValue* root) {
for (uint32_t bi = 0; jb && bi < tb_json_array_length(jb); bi++) {
TinyBlocks_JsonValue* o = tb_json_array_get(jb, bi);
int i = (int)jget_num(o, "i", -1);
if (i >= 0 && i < TB_BP_MAX_WS) {
TbBpBlock* b = &T->blocks[i];
TbBpBlock* b = tb_blueprint_tab_slot(T, i); /* cresce ate o indice i */
if (b) {
b->used = true;
snprintf(b->type, sizeof(b->type), "%s", jget_str(o, "type", ""));
b->x = (float)jget_num(o, "x", 0);
@@ -241,10 +241,17 @@ TbBlueprint* tb_blueprint_from_json(const TinyBlocks_JsonValue* root) {
TinyBlocks_JsonValue* top = tb_json_object_get(jt, "top");
T->top_n = 0;
for (uint32_t i = 0; top && i < tb_json_array_length(top) && T->top_n < TB_BP_MAX_WS; i++) {
for (uint32_t i = 0; top && i < tb_json_array_length(top); i++) {
TinyBlocks_JsonValue* e = tb_json_array_get(top, i);
T->top[T->top_n++] = e ? (int)tb_json_as_number(e, 0) : 0;
int h = e ? (int)tb_json_as_number(e, 0) : 0;
tb_json_release(e);
if (T->top_n >= T->top_cap) {
int nc = T->top_cap ? T->top_cap * 2 : 32;
int* p = (int*)realloc(T->top, (size_t)nc * sizeof(*p));
if (!p) break;
T->top = p; T->top_cap = nc;
}
T->top[T->top_n++] = h;
}
tb_json_release(top);
@@ -412,7 +419,7 @@ static void blueprint_xml(Buf* b, const TbBlueprint* bp) {
for (int i = 0; i < T->top_n; i++) { char t[24]; snprintf(t, sizeof(t), "<i>%d</i>", T->top[i]); bs(b, t); }
bs(b, "</top>\n");
bindent(b, 3); bs(b, "<blocks>\n");
for (int i = 0; i < TB_BP_MAX_WS; i++) {
for (int i = 0; i < T->blocks_n; i++) {
const TbBpBlock* bl = &T->blocks[i];
if (!bl->used) continue;
bindent(b, 4); bs(b, "<block");
@@ -529,7 +536,7 @@ static TinyBlocks_JsonValue* blueprint_csv_tree(const TbBlueprint* bp) {
TinyBlocks_JsonValue* arr = tb_json_array();
for (int ti = 0; ti < bp->tab_count; ti++) {
const TbBpTab* T = &bp->tabs[ti];
for (int i = 0; i < TB_BP_MAX_WS; i++) {
for (int i = 0; i < T->blocks_n; i++) {
const TbBpBlock* b = &T->blocks[i];
if (!b->used) continue;
TinyBlocks_JsonValue* o = tb_json_object();