summaryrefslogtreecommitdiffstats
path: root/src/jsbundle.c
blob: ad982507de760016227396b1c220626f280d9474 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <stdlib.h>
#include <stdio.h>
#include <dirent.h>
#include <string.h>

int main(int argc, char* argv[]) {
	char bundle_filename[64] = "../dist/js/bundle.js";
	DIR *dir;
	struct dirent *ent;
	if ((dir = opendir ("../layout/js/")) != NULL) {
		/* print all the files and directories within directory */
		while ((ent = readdir (dir)) != NULL) {
			if(strcmp(ent->d_name, ".") != 0 && strcmp(ent->d_name, "..") != 0) {
				char *dot = strrchr(ent->d_name, '.');
				if(dot && !strcmp(dot, ".js")) {
					printf ("%s\n", ent->d_name);
				}
			}
		}
		closedir (dir);
	} else {
		/* could not open directory */
		return 1;
	}
	return 0;
}