cook: handle V4K_TITLE path

main
Dominik Madarász 2023-10-10 07:55:06 +02:00
parent 1868986249
commit ffdc294d71
6 changed files with 33 additions and 5 deletions

View File

@ -586258,8 +586258,17 @@ bool cook_start( const char *cook_ini, const char *masks, int flags ) {
char *s = strchr( ART, ';' ); if(s) *s = 0; char *s = strchr( ART, ';' ); if(s) *s = 0;
char *w = strchr( ART, ' ' ); if(w) *w = 0; char *w = strchr( ART, ' ' ); if(w) *w = 0;
char *out = 0; const char *sep = ""; char *out = 0; const char *sep = "";
const char *v4k_title = getenv("V4K_TITLE");
for each_substring(ART, ",", t) { for each_substring(ART, ",", t) {
char *tmp = file_pathabs(va("%s%s", HOME, t)) + ART_LEN; char *tt = t;
if (v4k_title && strlen(v4k_title) > 0) {
const char *symbols[] = { "{{V4K_TITLE}}", getenv("V4K_TITLE") };
tt = (char *)strlerp(1, symbols, t);
} else if (strstri(tt, "{{V4K_TITLE}}")) {
continue;
}
char *tmp = file_pathabs(va("%s%s", HOME, tt)) + ART_LEN;
PRINTF("ART mount+=%s\n", tmp);
for(int i = 0; tmp[i]; ++i) if(tmp[i]=='\\') tmp[i] = '/'; for(int i = 0; tmp[i]; ++i) if(tmp[i]=='\\') tmp[i] = '/';
strcatf(&out, "%s%s%s", sep, tmp, strendi(tmp, "/") ? "" : "/"); strcatf(&out, "%s%s%s", sep, tmp, strendi(tmp, "/") ? "" : "/");
assert( out[strlen(out) - 1] == '/' ); assert( out[strlen(out) - 1] == '/' );

View File

@ -621,8 +621,17 @@ bool cook_start( const char *cook_ini, const char *masks, int flags ) {
char *s = strchr( ART, ';' ); if(s) *s = 0; char *s = strchr( ART, ';' ); if(s) *s = 0;
char *w = strchr( ART, ' ' ); if(w) *w = 0; char *w = strchr( ART, ' ' ); if(w) *w = 0;
char *out = 0; const char *sep = ""; char *out = 0; const char *sep = "";
const char *v4k_title = getenv("V4K_TITLE");
for each_substring(ART, ",", t) { for each_substring(ART, ",", t) {
char *tmp = file_pathabs(va("%s%s", HOME, t)) + ART_LEN; char *tt = t;
if (v4k_title && strlen(v4k_title) > 0) {
const char *symbols[] = { "{{V4K_TITLE}}", getenv("V4K_TITLE") };
tt = (char *)strlerp(1, symbols, t);
} else if (strstri(tt, "{{V4K_TITLE}}")) {
continue;
}
char *tmp = file_pathabs(va("%s%s", HOME, tt)) + ART_LEN;
PRINTF("ART mount+=%s\n", tmp);
for(int i = 0; tmp[i]; ++i) if(tmp[i]=='\\') tmp[i] = '/'; for(int i = 0; tmp[i]; ++i) if(tmp[i]=='\\') tmp[i] = '/';
strcatf(&out, "%s%s%s", sep, tmp, strendi(tmp, "/") ? "" : "/"); strcatf(&out, "%s%s%s", sep, tmp, strendi(tmp, "/") ? "" : "/");
assert( out[strlen(out) - 1] == '/' ); assert( out[strlen(out) - 1] == '/' );

View File

@ -4435,8 +4435,17 @@ bool cook_start( const char *cook_ini, const char *masks, int flags ) {
char *s = strchr( ART, ';' ); if(s) *s = 0; char *s = strchr( ART, ';' ); if(s) *s = 0;
char *w = strchr( ART, ' ' ); if(w) *w = 0; char *w = strchr( ART, ' ' ); if(w) *w = 0;
char *out = 0; const char *sep = ""; char *out = 0; const char *sep = "";
const char *v4k_title = getenv("V4K_TITLE");
for each_substring(ART, ",", t) { for each_substring(ART, ",", t) {
char *tmp = file_pathabs(va("%s%s", HOME, t)) + ART_LEN; char *tt = t;
if (v4k_title && strlen(v4k_title) > 0) {
const char *symbols[] = { "{{V4K_TITLE}}", getenv("V4K_TITLE") };
tt = (char *)strlerp(1, symbols, t);
} else if (strstri(tt, "{{V4K_TITLE}}")) {
continue;
}
char *tmp = file_pathabs(va("%s%s", HOME, tt)) + ART_LEN;
PRINTF("ART mount+=%s\n", tmp);
for(int i = 0; tmp[i]; ++i) if(tmp[i]=='\\') tmp[i] = '/'; for(int i = 0; tmp[i]; ++i) if(tmp[i]=='\\') tmp[i] = '/';
strcatf(&out, "%s%s%s", sep, tmp, strendi(tmp, "/") ? "" : "/"); strcatf(&out, "%s%s%s", sep, tmp, strendi(tmp, "/") ? "" : "/");
assert( out[strlen(out) - 1] == '/' ); assert( out[strlen(out) - 1] == '/' );

View File

@ -1,6 +1,7 @@
#define V4K_IMPLEMENTATION
#define COOK_ON_DEMAND 0 #define COOK_ON_DEMAND 0
#define COOK_FROM_TERMINAL 1 #define COOK_FROM_TERMINAL 1
#include "..\engine\v4k.c" #include "..\engine\joint\v4k.h"
int main(int argc, const char **argv) { int main(int argc, const char **argv) {
double timer = time_ss(); double timer = time_ss();

Binary file not shown.

View File

@ -7,7 +7,7 @@
; syntax: symbols are defined in KEY=value form, as seen below. ; syntax: symbols are defined in KEY=value form, as seen below.
TOOLS=./ ; folder where our pipeline tools are located TOOLS=./ ; folder where our pipeline tools are located
ART=../demos/art/,../engine/art/,../depot/art/common/,../depot/art/%V4K_TITLE%/ ; comma-separated folder(s) that store all our asset files ART=../demos/art/,../engine/art/,../depot/art/common/,../depot/art/{{V4K_TITLE}}/ ; comma-separated folder(s) that store all our asset files
; lines starting with @windows, @linux or @osx will be processed only where OS matches. ; lines starting with @windows, @linux or @osx will be processed only where OS matches.
; we are defining here some symbols differently for each platform. ; we are defining here some symbols differently for each platform.