Re: Why is NSString->FSRef so hard?

2009-05-04 Thread Uli Kusterer
On 30.04.2009, at 13:12, Alastair Houghton wrote: 3. AFAIK the Carbon layer maps them back again. Carbon's filesystem functions are implemented on top of the BSD layer, not alongside it as some people assume (OK, OK, there is the ".vol" special folder and there are a couple of additional en

Re: Why is NSString->FSRef so hard?

2009-05-04 Thread Uli Kusterer
On 29.04.2009, at 15:15, Mark Douma wrote: If you are working with file paths, you shouldn't be using componentsSeparatedByString:, nor should you be defining "/" to be the component you should be separating by. What if someone had your app inside of a folder they named "Apps/Utilities"? The

Re: Why is NSString->FSRef so hard?

2009-04-30 Thread Marcel Weiher
On 29.Apr, 2009, at 21:02 , Charles Srstka wrote: On 29 Apr 09, at 06:15, Mark Douma wrote: Carbon and the Finder are displaying the filenames as is, as HFS allows slashes to be in a filename, and the colon is the separator. Cocoa and the BSD layer, on the other hand, do swap the slashes a

Re: Why is NSString->FSRef so hard?

2009-04-30 Thread Andy Lee
On Apr 30, 2009, at 4:52 AM, Kyle Sluder wrote: In other words, why not just use the damn API? It's not like you need to deposit a coin to make a function call. If you did, we wouldn't have toll-free bridging. --Andy ___ Cocoa-dev mailing list (Co

Re: Why is NSString->FSRef so hard?

2009-04-30 Thread Alastair Houghton
On 30 Apr 2009, at 05:02, Charles Srstka wrote: Carbon and the Finder are displaying the filenames as is, as HFS allows slashes to be in a filename, and the colon is the separator. Cocoa and the BSD layer, on the other hand, do swap the slashes and colons. Presumably the idea is to display

Re: Why is NSString->FSRef so hard?

2009-04-30 Thread Kyle Sluder
On Thu, Apr 30, 2009 at 4:32 AM, ERG Consultant wrote: > / has been in use since the inception of unix in 1970 that's 39 years. I > seriously doubt it's going to change anytime soon. In 39 more years, i'll be > dead. Cocoa is derived from Openstep (or OPENSTEP, or OpEnStEp, depending on the sta

Re: Why is NSString->FSRef so hard?

2009-04-30 Thread ERG Consultant
/ has been in use since the inception of unix in 1970 that's 39 years. I seriously doubt it's going to change anytime soon. In 39 more years, i'll be dead. ERG Sent from my iPod On Apr 29, 2009, at 8:50 PM, Michael Ash wrote: On Wed, Apr 29, 2009 at 10:22 PM, Andrew Farmer wrote: On 29 Ap

Re: Why is NSString->FSRef so hard?

2009-04-29 Thread Michael Ash
On Thu, Apr 30, 2009 at 12:02 AM, Charles Srstka wrote: > With that said, I don't really see what is harmful about recommending the > use of NSString's path concatenation methods, which could save quite a few > headaches in the case that this *does* somehow change for some bizarre > reason, howeve

Re: Why is NSString->FSRef so hard?

2009-04-29 Thread Jim Correia
On Thu, Apr 30, 2009 at 12:02 AM, Charles Srstka wrote: > With that said, I don't really see what is harmful about recommending the > use of NSString's path concatenation methods, which could save quite a few > headaches in the case that this *does* somehow change for some bizarre > reason, howeve

Re: Why is NSString->FSRef so hard?

2009-04-29 Thread Charles Srstka
On Apr 29, 2009, at 9:22 PM, Andrew Farmer wrote: On 29 Apr 09, at 06:15, Mark Douma wrote: If you are working with file paths, you shouldn't be using componentsSeparatedByString:, nor should you be defining "/" to be the component you should be separating by. What if someone had your app

Re: Why is NSString->FSRef so hard?

2009-04-29 Thread Michael Ash
On Wed, Apr 29, 2009 at 10:22 PM, Andrew Farmer wrote: > On 29 Apr 09, at 06:15, Mark Douma wrote: >> >> If you are working with file paths, you shouldn't be using >> componentsSeparatedByString:, nor should you be defining "/" to be the >> component you should be separating by. What if someone ha

Re: Why is NSString->FSRef so hard?

2009-04-29 Thread Andrew Farmer
On 29 Apr 09, at 06:15, Mark Douma wrote: If you are working with file paths, you shouldn't be using componentsSeparatedByString:, nor should you be defining "/" to be the component you should be separating by. What if someone had your app inside of a folder they named "Apps/Utilities"? The

Re: Why is NSString->FSRef so hard?

2009-04-29 Thread Mark Douma
On Apr 28, 2009, at 1:34 AM, Erg Consultant wrote: if( glBundle ) { // Get main bundle info dict... d = [ glBundle infoDictionary ]; if( d ) { // Get the GL bundle's path from the info dict... z = [ d objectForKey:kNSBundleInitialPathInfoDictKey ];

Re: Why is NSString->FSRef so hard?

2009-04-28 Thread Charles Srstka
On Apr 28, 2009, at 4:13 PM, Erg Consultant wrote: This is a DRM situation where there are multiple app executables inside the main .app bundle. NSTask. Charles ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin reque

Re: Why is NSString->FSRef so hard?

2009-04-28 Thread Erg Consultant
This is a DRM situation where there are multiple app executables inside the main .app bundle. From: Kyle Sluder To: Erg Consultant Cc: cocoa-dev Sent: Tuesday, April 28, 2009 2:11:40 PM Subject: Re: Why is NSString->FSRef so hard? On Tue, Apr 28, 2009 a

Re: Why is NSString->FSRef so hard?

2009-04-28 Thread Kyle Sluder
On Tue, Apr 28, 2009 at 5:03 PM, Erg Consultant wrote: > How does one launch an exe inside an app bundle if LSOpenApplication isn't > desgined to do that? "exe"? You need to specify what you mean: executable binary, which is just a plain binary file, or application, which is wrapped in a .app b

Re: Why is NSString->FSRef so hard?

2009-04-28 Thread Erg Consultant
hy is NSString->FSRef so hard? Le 28 avr. 09 à 17:47, Michael Ash a écrit : > On Tue, Apr 28, 2009 at 1:13 AM, Erg Consultant > wrote: >> Apple's doc's specifically say to stay away from using the "CString" >> routines which require encodings. So now th

Re: Why is NSString->FSRef so hard?

2009-04-28 Thread Erg Consultant
:07:00 AM Subject: Re: Why is NSString->FSRef so hard? On Mon, Apr 27, 2009 at 10:13 PM, Erg Consultant wrote: > Apple's doc's specifically say to stay away from using the "CString" routines > which require encodings. Where do they say that? -- Clark S

Re: Why is NSString->FSRef so hard?

2009-04-28 Thread Jean-Daniel Dupas
Le 28 avr. 09 à 17:47, Michael Ash a écrit : On Tue, Apr 28, 2009 at 1:13 AM, Erg Consultant wrote: Apple's doc's specifically say to stay away from using the "CString" routines which require encodings. So now the encoding issue goes away. The problem is LSOpenApplication() does not like

Re: Why is NSString->FSRef so hard?

2009-04-28 Thread Clark Cox
On Mon, Apr 27, 2009 at 10:13 PM, Erg Consultant wrote: > Apple's doc's specifically say to stay away from using the "CString" routines > which require encodings. Where do they say that? -- Clark S. Cox III clarkc...@gmail.com ___ Cocoa-dev mailing

Re: Why is NSString->FSRef so hard?

2009-04-28 Thread Michael Ash
On Tue, Apr 28, 2009 at 1:13 AM, Erg Consultant wrote: > Apple's doc's specifically say to stay away from using the "CString" routines > which require encodings. So now the encoding issue goes away. The problem is > LSOpenApplication() does not like the FSRef I pass it which gets created from >

Re: Why is NSString->FSRef so hard?

2009-04-28 Thread Erg Consultant
cocoa-dev@lists.apple.com Sent: Tuesday, April 28, 2009 12:22:38 AM Subject: Re: Why is NSString->FSRef so hard? On Apr 27, 2009, at 9:14 PM, Erg Consultant wrote: > I write the original STL string to a tmp file, then read it back in. The file > is encoded in MacRoman. I tried UTF8 with

Re: Why is NSString->FSRef so hard?

2009-04-28 Thread Chris Hanson
On Apr 27, 2009, at 9:14 PM, Erg Consultant wrote: I write the original STL string to a tmp file, then read it back in. The file is encoded in MacRoman. I tried UTF8 with both converting and reinterpreting but if I use UTF8 when I read it back from file, the read returns nil. If I use MacRo

Re: Why is NSString->FSRef so hard?

2009-04-27 Thread Erg Consultant
I should mention I am using XCode 2.5 under 10.5 so I cannot use the 10.5 SDK nor Obj-C 2.0. Erg From: Stephen J. Butler To: Cocoa-Dev List Sent: Monday, April 27, 2009 11:14:44 PM Subject: Re: Why is NSString->FSRef so hard? On Tue, Apr 28, 2009 at 12

Re: Why is NSString->FSRef so hard?

2009-04-27 Thread Stephen J. Butler
On Tue, Apr 28, 2009 at 12:21 AM, Erg Consultant wrote: > LSOpenCFURLRef doesn't work either - kLSApplicationNotFoundErr. > > The nature of the file is the app's exe which is normally inside the MacOS > dir. > > However, all this works perfectly fine if there are no special chars in the > path -

Re: Why is NSString->FSRef so hard?

2009-04-27 Thread Erg Consultant
___ From: Ken Thomases To: Erg Consultant Cc: cocoa-dev@lists.apple.com Sent: Saturday, April 25, 2009 6:12:33 PM Subject: Re: Why is NSString->FSRef so hard? On Apr 25, 2009, at 8:03 PM, Erg Consultant wrote: > On Apr 25, 2009, at 7:48 PM, Stephen J. Butler wrote: &g

Re: Why is NSString->FSRef so hard?

2009-04-27 Thread Erg Consultant
ect: Re: Why is NSString->FSRef so hard? On Apr 27, 2009, at 11:51 PM, Erg Consultant wrote: > 4) I verified that the file I am trying to open using LSOpenApplication > exists at the path the URL points to when it gets converted to an FSRef. > > So why isn't it working? Why does

Re: Why is NSString->FSRef so hard?

2009-04-27 Thread Erg Consultant
eated from the path NSString->CFURL->FSRef. Erg From: Michael Ash To: cocoa-dev Sent: Monday, April 27, 2009 9:51:14 PM Subject: Re: Why is NSString->FSRef so hard? On Tue, Apr 28, 2009 at 12:26 AM, Erg Consultant wrote: > One other thing I shou

Re: Why is NSString->FSRef so hard?

2009-04-27 Thread Ken Thomases
On Apr 27, 2009, at 11:51 PM, Erg Consultant wrote: 4) I verified that the file I am trying to open using LSOpenApplication exists at the path the URL points to when it gets converted to an FSRef. So why isn't it working? Why does LSOpenApplication give me an error? What is the path/URL/F

Re: Why is NSString->FSRef so hard?

2009-04-27 Thread Erg Consultant
lppiProcInfo->dwProcessId = (DWORD)pid; result = true; } } } } ____________ From: Michael Ash To: cocoa-dev Sent: Monday, April 27, 2009 9:57:33 PM Subject: Re: Why is NSString->FSRef so hard? On Tue, Apr 28, 2009 at 12:51 AM, Erg Consultant wrote: >

Re: Why is NSString->FSRef so hard?

2009-04-27 Thread Michael Ash
On Tue, Apr 28, 2009 at 12:51 AM, Erg Consultant wrote: > So why isn't it working? Why does LSOpenApplication give me an error? It is impossible to answer questions of this nature if you do not post your code. Mike ___ Cocoa-dev mailing list (Cocoa-de

Re: Why is NSString->FSRef so hard?

2009-04-27 Thread Erg Consultant
e URL points to when it gets converted to an FSRef. So why isn't it working? Why does LSOpenApplication give me an error? Erg From: Ken Thomases To: Erg Consultant Cc: cocoa-dev@lists.apple.com Sent: Monday, April 27, 2009 9:41:01 PM Subject: Re: Why i

Re: Why is NSString->FSRef so hard?

2009-04-27 Thread Michael Ash
On Tue, Apr 28, 2009 at 12:26 AM, Erg Consultant wrote: > One other thing I should mention - the mangled char in question is the tm > symbol (option-2). In its string form, the debugger shows it as the tm char. > > But when I convert the string to an NSURL using fileURLWithPath, and then do > a

Re: Why is NSString->FSRef so hard?

2009-04-27 Thread Ken Thomases
On Apr 27, 2009, at 11:26 PM, Erg Consultant wrote: One other thing I should mention - the mangled char in question is the tm symbol (option-2). In its string form, the debugger shows it as the tm char. But when I convert the string to an NSURL using fileURLWithPath, and then do a CFShow,

Re: Why is NSString->FSRef so hard?

2009-04-27 Thread Erg Consultant
NSURL and CFURL not toll-free bridged? Erg From: Sean McBride To: Erg Consultant ; cocoa-dev@lists.apple.com Sent: Sunday, April 26, 2009 2:41:20 PM Subject: Re: Why is NSString->FSRef so hard? Erg Consultant (erg_consult...@yahoo.com) on 2009-04-25 7:33

Re: Why is NSString->FSRef so hard?

2009-04-27 Thread Erg Consultant
ingRef however does not work - the special characters get mangled. Erg From: Ken Thomases To: Erg Consultant Cc: cocoa-dev@lists.apple.com Sent: Saturday, April 25, 2009 6:12:33 PM Subject: Re: Why is NSString->FSRef so hard? On Apr 25, 2009, at 8:0

Re: Why is NSString->FSRef so hard?

2009-04-27 Thread Erg Consultant
r = LSOpenApplication( &inAppParams, &outPSN ); // <- Fails with -10810 error - Unexpected internal error From: Steve Christensen To: Erg Consultant Cc: cocoa-dev@lists.apple.com Sent: Saturday, April 25, 2009 6:04:14 PM Subject: Re: Why is NSString-&

Re: Why is NSString->FSRef so hard?

2009-04-26 Thread Sean McBride
Erg Consultant (erg_consult...@yahoo.com) on 2009-04-25 7:33 PM said: >Isn't there some easy way to get an FSRef from an NSString that is a >path containing special characters? You can use NDAlias: It provides an NSString category that converts t

Re: Why is NSString->FSRef so hard?

2009-04-25 Thread Ken Thomases
On Apr 25, 2009, at 8:03 PM, Erg Consultant wrote: On Apr 25, 2009, at 7:48 PM, Stephen J. Butler wrote: On Sat, Apr 25, 2009 at 7:28 PM, Erg Consultant wrote: I was using CFURLGetFSRef passing in the NSString which works fine as long as the path contains no special chars. If it does, CFU

Re: Why is NSString->FSRef so hard?

2009-04-25 Thread Michael Ash
On Sat, Apr 25, 2009 at 8:28 PM, Erg Consultant wrote: > I was using CFURLGetFSRef passing in the NSString which works fine as long as > the path contains no special chars. If it does, CFURLGetFSRef returns nil. That's unlikely. CFURLGetFSRef needs a CFURLRef or NSURL, not an NSString. If you w

Re: Why is NSString->FSRef so hard?

2009-04-25 Thread Ken Thomases
On Apr 25, 2009, at 7:28 PM, Erg Consultant wrote: I was using CFURLGetFSRef passing in the NSString which works fine as long as the path contains no special chars. If it does, CFURLGetFSRef returns nil. File path strings aren't URLs. Even a string which looks a bit URL- ish (for example,

Re: Why is NSString->FSRef so hard?

2009-04-25 Thread Steve Christensen
CFURLGetFSRef passing in the NSString which works fine as long as >the path contains no special chars. If it does, CFURLGetFSRef returns nil. > >Erg > > >From: Nick Zitzmann >To: Erg Consultant >Cc: cocoa-dev@lists.apple.com >Sent: Satur

Re: Why is NSString->FSRef so hard?

2009-04-25 Thread Erg Consultant
When I do that, the conversion from NSString to const UInt8 * path mangles the special characters in the path. From: Stephen J. Butler To: Cocoa-Dev List Sent: Saturday, April 25, 2009 5:48:09 PM Subject: Re: Why is NSString->FSRef so hard? On Sat, Apr

Re: Why is NSString->FSRef so hard?

2009-04-25 Thread Stephen J. Butler
On Sat, Apr 25, 2009 at 7:28 PM, Erg Consultant wrote: > I was using CFURLGetFSRef passing in the NSString which works fine as long as > the path contains no special chars. If it does, CFURLGetFSRef returns nil. CFURLGetFSRef is great if what you have originally is a CF/NSURL. But if you just ha

Re: Why is NSString->FSRef so hard?

2009-04-25 Thread Erg Consultant
4:41:20 PM Subject: Re: Why is NSString->FSRef so hard? On Apr 25, 2009, at 5:33 PM, Erg Consultant wrote: > Isn't there some easy way to get an FSRef from an NSString that is a path > containing special characters? What, specifically, have you tried? I don't

Re: Why is NSString->FSRef so hard?

2009-04-25 Thread Stephen J. Butler
On Sat, Apr 25, 2009 at 6:33 PM, Erg Consultant wrote: > I am trying to convert an NSString containing a path to a file directly to an > FSRef. If there are no special characters in the path, it's easy - I can go > from NSString to CFURL to FSRef. > > But if the path contains any special charact

Re: Why is NSString->FSRef so hard?

2009-04-25 Thread Michael Ash
On Sat, Apr 25, 2009 at 7:33 PM, Erg Consultant wrote: > I am trying to convert an NSString containing a path to a file directly to an > FSRef. If there are no special characters in the path, it's easy - I can go > from NSString to CFURL to FSRef. > > But if the path contains any special charact

Re: Why is NSString->FSRef so hard?

2009-04-25 Thread Nick Zitzmann
On Apr 25, 2009, at 5:33 PM, Erg Consultant wrote: Isn't there some easy way to get an FSRef from an NSString that is a path containing special characters? What, specifically, have you tried? I don't think I've ever had +fileURLWithPath: fail on me with a path string, even if the string

Why is NSString->FSRef so hard?

2009-04-25 Thread Erg Consultant
I am trying to convert an NSString containing a path to a file directly to an FSRef. If there are no special characters in the path, it's easy - I can go from NSString to CFURL to FSRef. But if the path contains any special characters at all, both CFURL and NSURL creation routines fail. No matt