D
Daniel Harple
Hi,
I am embedding ruby in an application and shipping it with app as
well, so I need to setup the load path manually instead of calling
ruby_init_loadpath(). Here is the code:
NSBundle *bundle = [NSBundle mainBundle];
NSString *path = [NSString stringWithFormat"%@/../Resources/ruby",
[bundle pathForAuxiliaryExecutable"My App"]];
load_path = rb_ary_new();
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_gv_set("$:", load_path);
I get this error:
ruby: $: is a read-only variable (NameError)
How can I get around this?
Thanks,
-- Daniel
I am embedding ruby in an application and shipping it with app as
well, so I need to setup the load path manually instead of calling
ruby_init_loadpath(). Here is the code:
NSBundle *bundle = [NSBundle mainBundle];
NSString *path = [NSString stringWithFormat"%@/../Resources/ruby",
[bundle pathForAuxiliaryExecutable"My App"]];
load_path = rb_ary_new();
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_gv_set("$:", load_path);
I get this error:
ruby: $: is a read-only variable (NameError)
How can I get around this?
Thanks,
-- Daniel