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:
1 parent
2a2d22a64a
commit
bfa17eecea
15 files changed
+9784
-124
No files matched your search
@@ -490,7 +490,7 @@ static void indent(Sb* out, int depth) {
|
||||
}
|
||||
|
||||
static void render_chain(const Models* M, const TbBpTab* tab, int bi, int depth, Sb* out) {
|
||||
for (int c = bi; c >= 0 && c < TB_BP_MAX_WS && tab->blocks[c].used; c = tab->blocks[c].next) {
|
||||
for (int c = bi; c >= 0 && c < tab->blocks_n && tab->blocks[c].used; c = tab->blocks[c].next) {
|
||||
const TbBpBlock* b = &tab->blocks[c];
|
||||
int sh = block_shape(M, b->type);
|
||||
indent(out, depth);
|
||||
@@ -512,10 +512,11 @@ char* tb_scratchblocks_export(const TbBpTab* tab, const TbSbContext* cx) {
|
||||
Models M = models_load(cx);
|
||||
if (!M.m) return NULL;
|
||||
/* pilhas de cima para baixo */
|
||||
int order[TB_BP_MAX_WS], n = 0;
|
||||
int* order = tab->top_n > 0 ? (int*)malloc((size_t)tab->top_n * sizeof(int)) : NULL;
|
||||
int n = 0;
|
||||
for (int i = 0; i < tab->top_n; i++) {
|
||||
int bi = tab->top[i];
|
||||
if (bi < 0 || bi >= TB_BP_MAX_WS || !tab->blocks[bi].used) continue;
|
||||
if (bi < 0 || bi >= tab->blocks_n || !tab->blocks[bi].used || !order) continue;
|
||||
int k = n++;
|
||||
while (k > 0 && tab->blocks[order[k - 1]].y > tab->blocks[bi].y) { order[k] = order[k - 1]; k--; }
|
||||
order[k] = bi;
|
||||
@@ -526,6 +527,7 @@ char* tb_scratchblocks_export(const TbBpTab* tab, const TbSbContext* cx) {
|
||||
if (i) sb_str(&out, "\n");
|
||||
render_chain(&M, tab, order[i], 0, &out);
|
||||
}
|
||||
free(order);
|
||||
free(M.m);
|
||||
return out.p;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user