Skip to content

Instantly share code, notes, and snippets.

@juaxix
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juaxix/8281b1c9e5617ec87a36 to your computer and use it in GitHub Desktop.
Save juaxix/8281b1c9e5617ec87a36 to your computer and use it in GitHub Desktop.
Shiva :: Create S3DAIModels.cpp file list for Android exports
<?php
/*
* Example: php5\php.exe buildaimodels.php "C:\\Games\\YourGame\\build\\Android\\eclipse\\jni\\AIModels"
*/
echo "Generating list...\n";
$dir = $argv[1] or "C:\\Games\\YourGame\\build\\Android\\eclipse\\jni\\AIModels";
$dh = opendir($dir);
$txt = "//File generated by juax\n\n\n";
$n = 0;
while (false !== ($filename = readdir($dh))) {
if ($filename=="."||$filename==".."||$filename=="AIModels.cpp") continue; //dont include itself or system directories
$txt .= '#include "'.$filename.'"'."\n";
$n++;
echo "Included...".$filename."\n";
}
closedir($dh);
echo $n." files added to AIModels.cpp\n";
file_put_contents($dir."\\S3DAIModels.cpp",$txt);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment