Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > [MacOS X] finding the orig file of an alias

Reply
Thread Tools

[MacOS X] finding the orig file of an alias

 
 
Une bévue
Guest
Posts: n/a
 
      08-03-2006

for the time being i'm using the finder thru AppleScript and then aeosa
in order to find the original path of an alias.

that's time consuming ))

does exist a direct rubyish way to do that (as in perl for ex.) ?
--
une bévue
 
Reply With Quote
 
 
 
 
Logan Capaldo
Guest
Posts: n/a
 
      08-03-2006

On Aug 2, 2006, at 9:40 PM, Une b=E9vue wrote:

>
> for the time being i'm using the finder thru AppleScript and then =20
> aeosa
> in order to find the original path of an alias.
>
> that's time consuming ))
>
> does exist a direct rubyish way to do that (as in perl for ex.) ?
> --=20
> une b=E9vue
>


You might be able to use RubyCocoa to do it a little more directly.=

 
Reply With Quote
 
 
 
 
Dave Howell
Guest
Posts: n/a
 
      08-03-2006

On Aug 3, 2006, at 0:53, Yvon Thoraval wrote:

> from ruby side.
>
> if writing :
>
> fm=OSX::NSFileManager.defaultManager
>
> i get :
>
> NameError: uninitialized constant OSX::NSFileManager
>


That's odd. I got this:

irb(main):002:0> require 'osx/aeosa'
=> true
irb(main):003:0> require 'osx/cocoa'
=> true
irb(main):004:0> fm=OSX::NSFileManager.defaultManager
=> #<OSX::NSFileManager:0x2fc3e0 class='NSFileManager' id=0x434470>
irb(main):005:0>

Did you require 'osx/cocoa'?



 
Reply With Quote
 
Dave Howell
Guest
Posts: n/a
 
      08-03-2006

On Aug 3, 2006, at 0:53, Yvon Thoraval wrote:

> first, how to get the constant : "kCFURLPOSIXPathStyle" ? (I've put
> 0...)
> second how to call the method "CFURLCreateWithFileSystemPath" ?


Oh, yea, I forgot to mention that the fastest place to find answers to
these questions would be on the rubycocoa-talk mailing list....



 
Reply With Quote
 
Une bévue
Guest
Posts: n/a
 
      08-03-2006
Dave Howell <(E-Mail Removed)> wrote:

>
> Oh, yea, I forgot to mention that the fastest place to find answers to
> these questions would be on the rubycocoa-talk mailing list....


they have a tendancy, fo such a question, to direct me by Cocoa-Dev ))
--
une bévue
 
Reply With Quote
 
Une bévue
Guest
Posts: n/a
 
      08-03-2006
Dave Howell <(E-Mail Removed)> wrote:

> irb(main):004:0> fm=OSX::NSFileManager.defaultManager
> => #<OSX::NSFileManager:0x2fc3e0 class='NSFileManager' id=0x434470>
> irb(main):005:0>


ok thanx

> Did you require 'osx/cocoa'?


generally speaking yes, both of them (rubycocoa and aeosa).

but in a small trying script i might have forgot this "small detail" )))
--
une bévue
 
Reply With Quote
 
Une bévue
Guest
Posts: n/a
 
      08-03-2006
Dave Howell <(E-Mail Removed)> wrote:

> Did you require 'osx/cocoa'?


not at all, i'm sure about that ))

because, when :
require 'osx/cocoa'

i get an error within my text editor (TextMate) or at terminal :

LoadError: no such file to load -- rubycocoa
method gem_original_require
in custom_require.rb at line 27
method require
in custom_require.rb at line 27
at top level
in cocoa.rb at line 11
method require
in custom_require.rb at line 27
at top level
in read-alias.rb at line 5

when using "require 'osx/cocoa'" within XCode : no prob...
--
une bévue
 
Reply With Quote
 
Dave Howell
Guest
Posts: n/a
 
      08-04-2006

On Aug 3, 2006, at 16:20, Une b=E9vue wrote:

> Dave Howell <(E-Mail Removed)> wrote:
>
>> Did you require 'osx/cocoa'?

>
> not at all, i'm sure about that ))
>
> because, when :
> require 'osx/cocoa'
>
> i get an error within my text editor (TextMate) or at terminal :
>
> LoadError: no such file to load -- rubycocoa


> when using "require 'osx/cocoa'" within XCode : no prob...


Hmm. I suspect if you hunt around in ~/Library/Frameworks or=20
/Library/Frameworks, you'll find the RubyCocoa framework. Which is to=20
say, nowhere on your command-line path directories, but exactly where=20
Cocoa apps expect to find such things.

Based on the misery I've experienced in this situation, were I you, I=20
would now try to wipe every last trace of RubyCocoa off my system, then=20=

do a new install in order to get *one* copy of RubyCocoa that's visible=20=

to all the different ways you can run Ruby.

If you don't wipe it first, then you can easily get in a situation=20
where the command line is running a *different* version of RubyCocoa=20
than XCode, and that's hideous to debug.

Trust me on that one.


 
Reply With Quote
 
Dave Howell
Guest
Posts: n/a
 
      08-04-2006

On Aug 4, 2006, at 0:36, Yvon Thoraval wrote:
> i've tried several times having the same setup for ruby from command
> line and from XCode, and i've learned today darwinports isn't the
> best...
>
> what kind of install would you advice ?
>
> from cvs sources ?
>
> PS : on RubyCocoa list they advice me to use dp )))


Yes, people are always telling me about the lovely powers of
Darwinports/Fink/CVS/Gem and on and on. I don't believe them any more,
though. (Well, RubyGems has worked reasonably well for those things
that are available as gems.)

My current RubyCocoa (and Ruby 1.8.4) was installed by downloading a
tar.gz file or some such thing, and running
./configure
make
make install

Whatever that's called. Is that the best way? I have no idea. But it
did let me put things exactly where I wanted them, which for me, meant
that all my Ruby junk is in the highly visible /Library/Ruby, not in
/usr/local/whatever or /sw/someplace or /opt/secret/hiding/spot.
(Although I did get to discover that some part of the RubyCocoa
installer couldn't cope with installing from a path with spaces in it.
That's been fixed.)

And it seems to work, which is more than I can say for 66% of my
attempted Fink installs and 100% of my DarwinPorts attempts. I haven't
tried any CVS-ing yet, because I'm allergic to unripe software in
general.


 
Reply With Quote
 
Phillip Hutchings
Guest
Posts: n/a
 
      08-04-2006
I can't help you with calling the CF functions, the rubycocoa list
might know more

> i seems that "OSX::NSFileManager.defaultManager" couldn't do the
> trick...


Unfortunately Cocoa can't actually handle aliases itself, you need to
use other functions. Google for 'Cocoa alias resolve', there's a few
informative pages.

--
Phillip Hutchings
http://www.sitharus.com/

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
reference/alias in perl vs reference/alias in C++ grocery_stocker C++ 9 05-24-2008 04:32 AM
XP X64 Pro, IE7, Delphi 2007, IntraWeb, MS Access, ODBC Alias problem: Insufficient memory for this operation. Alias: SomeDatabase. Skybuck Flying Windows 64bit 13 01-09-2008 07:34 PM
Shall We Dance (orig Jpn version) dvd Ed Kim DVD Video 2 01-31-2005 02:49 PM
USB prob / Win98 orig vers G. Morgan Computer Support 14 11-07-2004 10:33 AM
Forms Authentication, external authentication server, & rerouting to orig. req. URL Andrew Connell ASP .Net 1 10-21-2003 05:41 PM



Advertisments