From: Daniel Harple Date: 2006-08-20T08:40:19+09:00 Subject: Re: Initializing $LOAD_PATH manually? (embedding ruby) On Aug 19, 2006, at 7:18 PM, Daniel Harple wrote: > I get this error: > > ruby: $: is a read-only variable (NameError) > > How can I get around this? Well, that was dumb of me. This worked: NSBundle *bundle = [NSBundle mainBundle]; NSString *path = [NSString stringWithFormat:@"%@/../Resources/ruby", [bundle pathForAuxiliaryExecutable:@"My App"]]; VALUE load_path = rb_gv_get("$:"); rb_ary_push(load_path, rb_str_new2([[NSString stringWithFormat:@"%@/% s", path, "site_ruby/1.8"] UTF8String])); rb_ary_push(load_path, rb_str_new2([[NSString stringWithFormat:@"%@/% s", path, "site_ruby/1.8/powerpc-darwin8.7.0"] UTF8String])); rb_ary_push(load_path, rb_str_new2([[NSString stringWithFormat:@"%@/% s", path, "site_ruby"] UTF8String])); rb_ary_push(load_path, rb_str_new2([[NSString stringWithFormat:@"%@/% s", path, "1.8"] UTF8String])); rb_ary_push(load_path, rb_str_new2([[NSString stringWithFormat:@"%@/% s", path, "1.8/powerpc-darwin8.7.0"] UTF8String])); //rb_p(rb_gv_get("$:")); -- Daniel