4 * Generate cache file with information about apps
7 * - www/api/rest/connect/stick/stick/generate.php
9 require_once __DIR__ . '/functions.php';
10 $cacheDir = dirname(__FILE__, 2) . '/cache/';
11 if (!is_dir($cacheDir)) {
12 if (!mkdir($cacheDir)) {
13 fwrite(STDERR, "Failed to create cache dir: $cacheDir\n");
18 if (!isset($argv[1])) {
19 fwrite(STDERR, "Pass the path to a directory with game data json files\n");
23 if (!is_dir($gamesDir)) {
24 fwrite(STDERR, 'Given path is not a directory: ' . $gamesDir . "\n");
28 $appsCacheFile = $cacheDir . 'connect-apps.min.json';
29 $featuredAgesCacheFile = $cacheDir . 'connect-featured-ages.min.json';
31 $games = loadGames($gamesDir);
33 foreach ($games as $gameData) {
34 $connectGames[] = convertGameDataForConnect($gameData);
38 json_encode($connectGames, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)