Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autoload_dirs does not affect loading (0.7.6.6) #6

Closed
bil-bas opened this issue Jul 17, 2010 · 6 comments
Closed

autoload_dirs does not affect loading (0.7.6.6) #6

bil-bas opened this issue Jul 17, 2010 · 6 comments

Comments

@bil-bas
Copy link
Contributor

bil-bas commented Jul 17, 2010

Image::autoload_dirs and Sample::autoload_dirs methods do not correctly connect to the class instance variable used to autoload assets. Instead, they return a regular class variable (@@autoload_dirs) which is always an empty array and is not the same array as the one used to load assets, so altering it has no effect.

@ippa
Copy link
Owner

ippa commented Aug 2, 2010

I can't replicate this. A simple:

p Image.autoload_dirs
Image.autoload_dirs << "pictures"
p Image.autoload_dirs
exit

Gives me the expected default-dirs + the new "pictures"-dir in the second print.
What ruby / platform are you on? What would the above code print for you?

@ippa
Copy link
Owner

ippa commented Aug 2, 2010

Ah, markdown I love thou.. :)

@bil-bas
Copy link
Contributor Author

bil-bas commented Aug 2, 2010

require 'gosu'
require 'chingu'
include Gosu
p Image.autoload_dirs # => []
Image.autoload_dirs << "pictures"
p Image.autoload_dirs # => ["pictures"]

Resources will still be read from the defaults, but not from "pictures".

  • Ruby 1.9.1 or Ruby1.9.2 (Windows Ruby Installer)
  • gosu (0.7.22 i386-mingw32)
  • chingu (0.7.6.6)

@ippa
Copy link
Owner

ippa commented Aug 2, 2010

Ah, it's Chingu::Window that fills in default dirs... try p Image.autoload_dirs in Chingu::Window#setup for example.

@bil-bas
Copy link
Contributor Author

bil-bas commented Aug 2, 2010

Yes, you are quite right; thanks for sorting me out there. Putting the code into the Chingu::Window::setup made it work. Perhaps you should just push your default directories into that list rather than overwriting it, then it wouldn't matter exactly when the user added their preferred directories?

@ippa
Copy link
Owner

ippa commented Aug 2, 2010

good idea, done! :)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants