On Wed, 22 Oct 2008, Alexander Rakoczy wrote:

> Hello!
> 
> I have a little shoes twitter app named Gutter:
> http://github.com/toothrot/gutter/tree/master/gutter.rb
> 
> I'm encountering a problem that the second time I run the app, the
> cached images are gone, and shoes complains that it cannot find them.
> Oddly enough, the directories for the images are there, but the image
> files themselves are gone.

Well, this looks wrong for a start:

conf = YAML::load(File.open(File.join("#{ENV['HOME'] || 
ENV['USERPROFILE']}",'.gutter.yml')))

Which I'll fold thusly:

conf = YAML::load(
              File.open(
                 File.join("#{ENV['HOME'] || ENV['USERPROFILE']}",'.gutter.yml')
              )
              # at this point you have open'ed the file, but done nothing
              # with the file pointer, and at no point do you close it
           )

YAML::load takes a string.

I think you need this
  filename = File.join("#{ENV['HOME'] || ENV['USERPROFILE']}",'.gutter.yml')
  data = ''
  open(filename){|fp| data = fp.read} # the block closes the file
  conf = YAML::load(data)

> 
> After some investigation, it doesn't look like they are being created
> at all in the first place.  This is strange, because on one of my
> machines, it creates the files, but on my other machine, it does not.

  def save
    YAML::dump({'gutter' => {'login' => user, 'password' => password}}, 
File.open(File.join("#{ENV['HOME'] || ENV['USERPROFILE']}",'.gutter.yml'), 'w'))

    # This is essentially the same problem.

  rescue
    puts "Can't open preferences file"
  end
> Another strange problem (only on this machine) is that paths do not
> seem to work when launching shoes either:
> 
> [EMAIL PROTECTED]:~$ shoes gutter.rb
> 
> (Shoes console:
>   Error in shoes.rb line 350
>     No such file or directory, 'gutter.rb')

Not sure about that one.
> 
> However, it will launch the file if i instead just run "shoes" and
> choose it out of the file opener.
> 
> Maybe this is related?
> 
> I am running the shoes-0.r1057 build for Linux in Ubuntu 8.10.  My
> other (working machine) is also running shoes-0.r1057 in Ubuntu 8.04
> 
> Alex
> 
> -- 
> alexander rakoczy | jerkface extraordinaire | http://www.arakoczy.com
> 
        Hugh

Reply via email to