/*
* Wolkenwelten - Copyright (C) 2020-2021 - Benjamin Vincent Schulenburg
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
#include
char *fileSlug(char *path){
static char ret[1024];
char c,*r,*start;
r = ret;
start = NULL;
while((c = *path++)){
if((c == '/') || (c == '.') || (c < 32)){
if(start == NULL){start = r+1;}
*r++ = '_';
continue;
}
*r++ = c;
}
*r = 0;
return start;
}
int main(int argc,char *argv[]){
char fn[512];
snprintf(fn,sizeof(fn)-1,"%s.c",argv[1]);
fn[sizeof(fn)-1] = 0;
FILE *cfp = fopen(fn,"w");
snprintf(fn,sizeof(fn)-1,"%s.h",argv[1]);
fn[sizeof(fn)-1] = 0;
FILE *hfp = fopen(fn,"w");
static unsigned char buffer[1024*1024*32];
size_t filelen=0,readlen=0,ii;
int lc=0,i;
if((cfp == NULL) || (hfp == NULL)){
fprintf(stderr,"Error opening src/tmp/assets*");
return 1;
}
fprintf(hfp,"#pragma once\n#include \n\n");
fprintf(cfp,"#include \n\n");
for(i=2;i 19){
fprintf(cfp,"\n ");
lc=0;
}
}
fprintf(cfp,"0\n};\n\n");
}
fclose(cfp);
fclose(hfp);
return 0;
}