Re: (solved?) baseURL problem with +fileURLWithPath:
Re: (solved?) baseURL problem with +fileURLWithPath:
- Subject: Re: (solved?) baseURL problem with +fileURLWithPath:
- From: Robert Monaghan <email@hidden>
- Date: Tue, 18 May 2010 14:51:11 +0200
Ok, I am doing this now, which *seems* to work.
NSURL *url = [NSURL URLWithString:[[pathurlArray objectAtIndex:0] stringValue] relativeToURL:nil];
bob..
On May 18, 2010, at 2:20 PM, Robert Monaghan wrote:
> The path from [[pathurlArray objectAtIndex:0] stringValue] is going into the NSURL properly.
> This doesn't appear to be a problem with retaining the source NSArray object.
>
> The base URL, however is being populated with the path to my binary. I am trying to figure out how to set the baseURL to nil.
> If I print a description, I get:
>
> <CFURL 0xe5d8270 [0xa0474ee0]>{type = 15, string = file:/localhost/Users/bob/Movies/ARRI/ELAP/shot_1_2/Imagery/Proxies/DMAG001_1_2_TAKE_005_RAWPROXY720P.mov, encoding = 134217984
> base = <CFURL 0x36530210 [0xa0474ee0]>{type = 0, string = /Users/bob/Development/GT_Dig/GT_Cons/build/Debug/, encoding = 134217984, base = (null)}}
>
> bob.
>
> On May 18, 2010, at 2:12 PM, Abhinay Kartik Reddyreddy wrote:
>
>>
>> On May 18, 2010, at 7:52 AM, Robert Monaghan wrote:
>>
>>> Hi Mike,
>>>
>>> This is pretty trivial.. I have a string that is coming from an FCP XML file. The string looks like this:
>>> file:/localhost/Users/bob/Movies/ARRI/ELAP/shot_1_2/Imagery/Proxies/DMAG001_1_2_TAKE_005_RAWPROXY720P.mov
>>>
>>> I then pass the string to an NSURL object using: (Yes, I know I can do a "fileURLWithPath:" -- I am trying to troubleshoot where the problem is.)
>>> NSURL *url = [[[NSURL alloc] initFileURLWithPath:[[pathurlArray objectAtIndex:0] stringValue]] autorelease];
>>>
>>
>> How about if you copy [[pathurlArray objectAtIndex:0] stringValue] into a NSString, retain it and create a NSURL instead of creating from pathurlArray directly...??
>>
>>> Then, I try to get an NSString object by doing:
>>> [url path]
>>>
>>
>> What would be the value in [[pathurlArray objectAtIndex:0] stringValue] at this point...?? May be the pathurlArray is Auto released before you create the NSURL...?? Just a guess....
>>
>>> This is where things go wildly wrong.. the NSString value ends up being a path to my binary.
>>>
>>>
>>> bob.
>>>
>>>
>>> On May 18, 2010, at 12:55 PM, Mike Abdullah wrote:
>>>
>>>> Show us some code.
>>>>
>>>> On 18 May 2010, at 09:49, Robert Monaghan wrote:
>>>>
>>>>> Hi Everyone..
>>>>>
>>>>> I am loosing my mind with NSURL's initFileURLWithPath. (Trying to build a 10.5 app.. btw)
>>>>>
>>>>> If I create a NSURL object with a local file path, everything looks as it should, when stepping through the code with the debugger.
>>>>> However, when I use "[myURL path]" in my code, I get a path to my binary instead of the path that is placed into NSURL object.
>>>>> After doing some reading, this looks as if my local file path is being set as the "Relative" path, and the binary application is set as
>>>>> the "BaseURL".
>>>>>
>>>>> Can someone (preferably from Apple) explain why this is broken with file paths?
>>>>> -- Yes.. it is broken, as there is no way to set the baseURL, nor is there a way to set my local file path as the baseURL.
>>>>> --- I used absoluteURL, but that only returns the binary path.
>>>>>
>>>>> I hope I don't have to remove these NSURL objects and replace them with NSStrings..
>>>>> what a pain in the a..
>>>>>
>>>>> bob.
>>>>>
>>>>> _______________________________________________
>>>>>
>>>>> Cocoa-dev mailing list (email@hidden)
>>>>>
>>>>> Please do not post admin requests or moderator comments to the list.
>>>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>>>
>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>
>>>>> This email sent to email@hidden
>>>>
>>>
>>> _______________________________________________
>>>
>>> Cocoa-dev mailing list (email@hidden)
>>>
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden