feat(framework): assets/ subfolder para distribuibles read-only

Refina la convencion de layout: el top de cada app distribuible
solo lleva el .exe + DLLs nativas; todo lo demas (TTFs, enrichers,
runtime Python, MCP servers) vive en <exe_dir>/assets/.

Cambios:
- cpp/CMakeLists.txt::add_imgui_app — copia las 5 TTFs (Karla,
  Roboto, DroidSans, Cousine, tabler-icons) a
  $<TARGET_FILE_DIR>/assets/ en lugar de junto al exe.
- framework/app_base: nuevas funciones fn::asset_dir() y
  fn::asset_path(name) que resuelven a <exe_dir>/assets/<name>.
- functions/core/icon_font.cpp::find_asset — anade
  fn::asset_path(filename) como PRIMERA ruta de busqueda, antes
  de las legacy ./<file> y ./assets/<file>. Mantiene los
  fallbacks para dev (FN_ASSETS_DIR, FN_CPP_ROOT).
- .claude/commands/compile.md — el deploy a Desktop pone TTFs +
  enrichers/ + runtime/ + gx-cli en <DEST>/assets/. Solo .exe y
  DLLs nativas (duckdb.dll) quedan en el top. local_files/ se
  preserva si existe.

Layout final:
  Desktop/apps/<APP>/
  ├── <APP>.exe + *.dll          (binario + DLLs Windows)
  ├── assets/                    (read-only distribuible)
  │   ├── *.ttf, enrichers/, runtime/, gx-cli, ...
  └── local_files/               (per-PC, creado al primer arranque)

Esto cierra la separacion conceptual de la convencion: la carpeta
es trivial de zippear (solo .exe + assets/), el reset/sync es
trivial (local_files/), y todas las apps del registry adoptan el
mismo layout via fn_framework.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-03 00:50:33 +02:00
parent 6249e01419
commit 81d8a7c95d
5 changed files with 92 additions and 31 deletions
+24
View File
@@ -106,6 +106,30 @@ const char* local_path(const char* name) {
return buf.c_str();
}
namespace {
const std::string& asset_dir_ref() {
static std::string cached;
static bool inited = false;
if (inited) return cached;
const std::string& edir = exe_dir_ref();
cached = edir.empty() ? std::string("assets") : edir + "/assets";
inited = true;
return cached;
}
} // namespace
const char* asset_dir() { return asset_dir_ref().c_str(); }
const char* asset_path(const char* name) {
static thread_local std::string buf;
buf = asset_dir_ref();
if (name && *name) {
if (!buf.empty() && buf.back() != '/' && buf.back() != '\\') buf += '/';
buf += name;
}
return buf.c_str();
}
void migrate_to_local_files(const char* const* names, std::size_t n) {
if (!names || n == 0) return;
const std::string& ldir = local_dir_ref();