Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / adding files to the OCRA executable
- - By kaBOOM Date 2011-04-14 06:32
Hello again. I was wondering if there is an easy way to add numerous files to ocra executable. I can't type by hand all my game assets on the console window; too many. :)

Thank you.
Parent - - By jlnr (dev) Date 2011-04-14 07:04 Edited 2011-04-14 07:10
I like to keep a Rakefile around for pretty much all my projects (not just Ruby). You can look it up, it's not nearly as scary as a Makefile. In your case you could simply do


task :ocra do
  all_my_images = Dir['media/**/*.png'] # all PNG files in any subfolder in media
  # all_my_images is ust a plain Ruby Array here
  sh "ocra ... ... ... #{all_my_images.join(' ')}" # I don't know the actual parameters for ocra
end
Parent - - By Spooner Date 2011-04-18 16:50
You can actually keep it simple, since ocra does globbing for you:
system "ocra mygame.rb media/**/*.png bin/**/*.*"
Parent - - By kaBOOM Date 2011-04-19 09:51
Thanks for the replies everyone. Concerning the second method:
What does "media/**/*.png" means. Ocra will scan in the media folder for any .png files and add them? What does the "/**/" stand for then?

Thank You.
Parent - - By Spooner Date 2011-04-19 10:44
It is what is called "globbing" and is just the same as is done with Dir[] in the first example (which is a shortcut for Dir.glob(), I think) . '/**/' Means match zero or more nested directories, '/*/' means match any single directory, '*' means any file and '*.png' means match all files with extension of png (so '**/*.png' would find 'fish.png', 'frog/fish.png' and 'i/like/knees/and/fleas.png').
Parent - By kaBOOM Date 2011-04-19 11:03
Sir...  you made my day.
Thank You.
Up Topic Gosu / Gosu Exchange / adding files to the OCRA executable

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill