[MacRuby-devel] Appscript and pathname translation
Hello again, Macruby community! I'm trying to rewrite a program that drives Excel with appscript, and running into the problem of translating back and forth between HFS and POSIX pathnames. The old Appscript module included a MacTypes module, and these two translations were provided. 1. to go from POSIX to HFS: hfs_pathname = MacTypes::FileURL.path(posix_pathname).hfs_path 2. to make the round trip back to POSIX: posix_pathname = DefaultCodecs.unpack(DefaultCodecs.pack(hfs_pathname).coerce(KAE::TypeFileURL)).path Do I need to go to the scripting bridge for this? This is Core Foundation stuff, and I'm totally at sea. Any help would be greatly appreciated. Bob Schaaf ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Appscript and pathname translation
Hi Bob, If at all possible I'd try and avoid the conversion. If this is not feasible, this could help: def posix_from_hfs(hfs) url = CFURLCreateWithFileSystemPath(nil, hfs, KCFURLHFSPathStyle, false) # final argument is whether the path is a directory or not url.path end def hfs_from_posix(posix) url = NSURL.fileURLWithPath posix CFURLCopyFileSystemPath(url, KCFURLHFSPathStyle) end The first method needs reworking, as it assumes that the HFS path is not a directory. I've only did a very brief test of the above code, but it seems to do the job. Al On 18 Apr 2012, at 12:48, Robert Schaaf wrote: > Hello again, Macruby community! > > I'm trying to rewrite a program that drives Excel with appscript, and running > into the problem of translating back and forth between HFS and POSIX > pathnames. The old Appscript module included a MacTypes module, and these > two translations were provided. > > 1. to go from POSIX to HFS: > > hfs_pathname = MacTypes::FileURL.path(posix_pathname).hfs_path > > 2. to make the round trip back to POSIX: > > posix_pathname = > DefaultCodecs.unpack(DefaultCodecs.pack(hfs_pathname).coerce(KAE::TypeFileURL)).path > > Do I need to go to the scripting bridge for this? This is Core Foundation > stuff, and I'm totally at sea. > > Any help would be greatly appreciated. > > Bob Schaaf > > > ___ > MacRuby-devel mailing list > [email protected] > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
[MacRuby-devel] Help with class files
Help, I have a recurring problem with corrupted class files created by Xcode 3.2.4 and I don't know much about class files. I start having this problem whenever my application become large and I try to change the inheritance of some MacRuby files. Occasionally, the change will cause Interface Builder to crash immediately without an error message but usually the problem manifests itself by not updating the class inheritance information in IB. Even after selecting "Reload All Class Files", IB will show the old inheritance. Deleting my file from Xcode and adding it back in still does not fix the problem. The only way I know to fix the problem is to copy all of my source file into a new project but this is getting to be more than annoying. Is there a way that I can force Xcode to rebuild all class files for my project? Thanks, Bob Rice ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Installer Fails
Hi Watson, I tried the 4/18 nightly build and it still fails, although it seems to have gotten further. Now the last line in the files window is: ./usr/local/share/man/man1/macrubyd.1 Thanks, Bob Rice On Apr 17, 2012, at 11:18 AM, Watson wrote: > I fixed the MacRuby sample. > > Please try with > https://github.com/MacRuby/MacRuby/compare/eabb31c507...9539a531a7 > > I think you will be able to build the MacRuby samples by buildall.rb: > $ ruby buildall.rb ~/tmp > > > Thanks > > 2012/4/17 Robert Rice : >> Hi Watson, >> >> The 2012-04-17 nightly fails on my system. The last line in the files window >> is: >> ./tmp/macruby/sample-macruby/buildall.rb >> >> Hope that helps, >> Bob Rice >> >> >> On Apr 16, 2012, at 9:45 PM, Watson wrote: >> >>> I think that MacRuby still supports the Xcode3. >>> >>> We updated at several times about packager which include the Xcode3 >>> template into installer, >>> so nightly build which you have might lost the Xcode3 template. >>> >>> please try with latest. >>> >>> >>> Thanks, >>> >>> 2012/4/17 Robert Rice : Hi, I'm still using Xcode 3.2.4. Does MacRuby now require Xcode 4? I backed up to the 1/1/2012 nightly. The 2/21/2012 nightly didn't have Xcode MacRuby templates. Thanks, Bob Rice On Apr 16, 2012, at 8:04 PM, Watson wrote: >> - Template and rb_nibtool was not installed. > I mistook. rb_nibtool was not installed. > > If you will install Xcode, you might need to reinstall MacRuby. > > > 2012/4/17 Watson : >> Hi >> >> Hmm, If Xcode was not installed, Installer might show "Installation >> Failed". >> https://github.com/MacRuby/MacRuby/blob/master/misc/release/package_script/postinstall#L10 >> >> - MacRuby framework was installed in your environment. So, you can use >> "macruby" command in Terminal. >> - Template and rb_nibtool was not installed. >> >> >> 2012/4/17 Robert Rice : >>> Hi MacRubyists, >>> >>> It's been a long time since I posted on this forum. I've been doing >>> well with MacRuby. But I ran into a problem trying to bring my >>> installation up-to-date. updated I found that I could only update to >>> the 2/21/2012 nightly build. After that the installer gives me a >>> message "Installation Failed" with nothing descriptive of the problem. >>> Anyone know what changed? >>> >>> Thanks, >>> Bob Rice >>> ___ >>> MacRuby-devel mailing list >>> [email protected] >>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel > ___ > MacRuby-devel mailing list > [email protected] > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel > ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >>> ___ >>> MacRuby-devel mailing list >>> [email protected] >>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >>> >> >> ___ >> MacRuby-devel mailing list >> [email protected] >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel > ___ > MacRuby-devel mailing list > [email protected] > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel > ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Installer Fails
Hi Watson, Thanks for you help. I guess that if Xcode 3 won't still work for me then it's time for me to upgrade to Xcode 4. After installing the latest Xcode 4 the latest MacRuby nightly install ran without a problem. Now I will have to learn Xcode 4. It seems that Xcode 4 is showing me which imported XIB files were corrupted instead of just crashing like IB did. Thanks, Bob On Apr 18, 2012, at 2:01 PM, Robert Rice wrote: > Hi Watson, > > I tried the 4/18 nightly build and it still fails, although it seems to have > gotten further. Now the last line in the files window is: > > ./usr/local/share/man/man1/macrubyd.1 > > Thanks, > Bob Rice > > > On Apr 17, 2012, at 11:18 AM, Watson wrote: > >> I fixed the MacRuby sample. >> >> Please try with >> https://github.com/MacRuby/MacRuby/compare/eabb31c507...9539a531a7 >> >> I think you will be able to build the MacRuby samples by buildall.rb: >> $ ruby buildall.rb ~/tmp >> >> >> Thanks >> >> 2012/4/17 Robert Rice : >>> Hi Watson, >>> >>> The 2012-04-17 nightly fails on my system. The last line in the files >>> window is: >>> ./tmp/macruby/sample-macruby/buildall.rb >>> >>> Hope that helps, >>> Bob Rice >>> >>> >>> On Apr 16, 2012, at 9:45 PM, Watson wrote: >>> I think that MacRuby still supports the Xcode3. We updated at several times about packager which include the Xcode3 template into installer, so nightly build which you have might lost the Xcode3 template. please try with latest. Thanks, 2012/4/17 Robert Rice : > Hi, > > I'm still using Xcode 3.2.4. Does MacRuby now require Xcode 4? > > I backed up to the 1/1/2012 nightly. The 2/21/2012 nightly didn't have > Xcode MacRuby templates. > > Thanks, > Bob Rice > > > On Apr 16, 2012, at 8:04 PM, Watson wrote: > >>> - Template and rb_nibtool was not installed. >> I mistook. rb_nibtool was not installed. >> >> If you will install Xcode, you might need to reinstall MacRuby. >> >> >> 2012/4/17 Watson : >>> Hi >>> >>> Hmm, If Xcode was not installed, Installer might show "Installation >>> Failed". >>> https://github.com/MacRuby/MacRuby/blob/master/misc/release/package_script/postinstall#L10 >>> >>> - MacRuby framework was installed in your environment. So, you can use >>> "macruby" command in Terminal. >>> - Template and rb_nibtool was not installed. >>> >>> >>> 2012/4/17 Robert Rice : Hi MacRubyists, It's been a long time since I posted on this forum. I've been doing well with MacRuby. But I ran into a problem trying to bring my installation up-to-date. updated I found that I could only update to the 2/21/2012 nightly build. After that the installer gives me a message "Installation Failed" with nothing descriptive of the problem. Anyone know what changed? Thanks, Bob Rice ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >> ___ >> MacRuby-devel mailing list >> [email protected] >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >> > > ___ > MacRuby-devel mailing list > [email protected] > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >>> >>> ___ >>> MacRuby-devel mailing list >>> [email protected] >>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >> ___ >> MacRuby-devel mailing list >> [email protected] >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >> > > ___ > MacRuby-devel mailing list > [email protected] > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel > ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
[MacRuby-devel] Elegant initialization
Hey, first post to the list, woot!
I've run into a little bit of a snag. Is there an elegant way of
building an initializer similar to this one in macruby? (assuming I'm
subclassing an NSView object)
- (id)initWithFrame:(NSRect)frame controller:(AppController *)ctrlr
{
if (self = [super initWithFrame:frame]) {
controller = ctrlr; // deliberately weak reference.
}
return self;
}
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Compile error
It's hard to know what exactly is going on here without seeing more of your project. Some things you can try though is to look through the build settings for your project for the string bundle1.o. It's not clear to me though why you would want to be linking a .o file? On Monday, April 16, 2012 at 6:52 PM, Robert Rice wrote: > Hi, > > I have a project nearing release and I'm trying to compile it but I get the > following error in my Build Results: > > *** Deployment started > *** Compiling files > ld: library not found for -lbundle1.o > collect2: ld returned 1 exit status > Can't compile > "/Users/robertrice/Desktop/RiceCNC/build/Release/RiceCNC.app/Contents/Resources/Analog_Setup_Controller.rb" > Command /bin/sh failed with exit code 1 > > > Any suggestions? > > Thanks, > Bob Rice > > > ___ > MacRuby-devel mailing list > [email protected] (mailto:[email protected]) > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel > > ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Help with class files
Have you tried "Clean All"? (I forget the exact wording in the Xcode 3 menu…but it's there with "Clean") On Wednesday, April 18, 2012 at 1:37 PM, Robert Rice wrote: > Help, > > I have a recurring problem with corrupted class files created by Xcode 3.2.4 > and I don't know much about class files. > > I start having this problem whenever my application become large and I try to > change the inheritance of some MacRuby files. Occasionally, the change will > cause Interface Builder to crash immediately without an error message but > usually the problem manifests itself by not updating the class inheritance > information in IB. Even after selecting "Reload All Class Files", IB will > show the old inheritance. Deleting my file from Xcode and adding it back in > still does not fix the problem. > > The only way I know to fix the problem is to copy all of my source file into > a new project but this is getting to be more than annoying. Is there a way > that I can force Xcode to rebuild all class files for my project? > > Thanks, > Bob Rice > > ___ > MacRuby-devel mailing list > [email protected] (mailto:[email protected]) > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel > > ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] Elegant initialization
Welcome! Hope you enjoy your stay!
You can write Obj-C-ish methods in MacRuby the same way you call them: using
Ruby's hash syntax. The only other caveat is the difference between "super" in
Ruby and Obj-C. In Obj-C, "super" is the superclass. In Ruby, it is shorthand
for calling the same method in the superclass. Also, in Ruby, you are not
allowed to redefine self. Finally, you generally don't need to worry about weak
references in Ruby (since cycles can be handled by the GC). So your above
method translated would look like this:
def initWithFrame(frame, controller: ctrlr)
initWithFrame(frame)
@controller = ctrlr
self
end
Cheers,
Josh
On Wednesday, April 18, 2012 at 11:44 PM, Josh Voigts wrote:
> Hey, first post to the list, woot!
>
> I've run into a little bit of a snag. Is there an elegant way of
> building an initializer similar to this one in macruby? (assuming I'm
> subclassing an NSView object)
>
>
> - (id)initWithFrame:(NSRect)frame controller:(AppController *)ctrlr
> {
> if (self = [super initWithFrame:frame]) {
> controller = ctrlr; // deliberately weak reference.
> }
>
> return self;
> }
> ___
> MacRuby-devel mailing list
> [email protected] (mailto:[email protected])
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
