Re: Server Path URL question
Re: Server Path URL question
- Subject: Re: Server Path URL question
- From: Becky Willrich <email@hidden>
- Date: Fri, 17 Aug 2007 10:24:12 -0700
Jim's spotted the problem. More generally, if you have a URL and are
trying to produce a path to go in to some file system call (like
FSPathMakeRef(), or any of the Objective-C path: methods), you should
use one of the URL routines with the words "FileSystem" in the name.
All of these will do the correcting necessary to convert a URL path to
a path suitable for the file system.
Hope that helps,
REW
On Aug 17, 2007, at 10:07 AM, Jim Luther wrote:
In a URI (URL), many characters are illegal that are legal in file
system paths. Those characters are percent-encoded. See rfc3986 <http://www.ietf.org/rfc/rfc3986.txt
> for the latest specification on URIs.
Some of the routines in CFURL replace percent-encoded characters,
some don't. Depending on the routines you use to convert a URL to a
string, you make have to percent-decode characters yourself. I think
you need to use CFURLCopyFileSystemPath() which replaces percent-
encoded characters.
- Jim
On Aug 16, 2007, at 9:59 PM, Daniel Brieck Jr. wrote:
Hello Quinn and all,
I am getting an error that is causing the assert after
FSPathMakeRef to fail when my Apple Script Studio calls the
Objective-C method below. I know what is causing the error but I
am not sure why it is happening?:
Here is what I have found:
If I run an Apple script to connect to a network drive my program
works.
--The script ran:
tell application "Finder"
open location "cifs://MSHOME;DANIELBR@IBM_NETVISTA/MYVIDEOS"
end tell
At that point when I get [***] the URL for that disk it is "file://localhost/Volumes/MYVIDEOS/
" which of course is filtered down to "/Volumes/MYVIDEOS/" before
calling the Objective-C method given below.
Every thing works fine on this try.
If I use the Finder GO menu > Network > ... way to connect to the
volume and run my program, it crashes with the error given below.
Now the URL is "file://localhost/Volumes/MSHOME;IBM_NETVISTA/"
which is shortened to "/Volumes/MSHOME;IBM_NETVISTA/"
FROM the terminal at this point there are the following volumes :
[MacBook-semi-Pro:/Volumes] danielbr% ls
MYVIDEOS MSHOME;DELLINS8200
Macintosh HD MSHOME;IBM_NETVISTA
and from that I see that "MSHOME;IBM_NETVISTA" is a problem.
Why is it giving a different path when using the GO menu in the
Finder. Specifically the ";" , I am almost certain this is what
is causing the error? It May be some kind of Apple Script error too
which resutls in ";" being replaced with ";". Any ideas or
suggestions? I am guessing the ";" may be some kind of escape
sequence or something... Can anyone confirm that ";" is a
constant part of network volumes mounted through the GO menu.
If I manually type in an input string of "/Volumes/
MSHOME;IBM_NETVISTA/" the program works.
Thank you,
Daniel J. Brieck Jr.
<<The Error>>
[Session started at 2007-08-16 21:29:10 -0400.]
/Users/danielbr/Programs/Network Drive (Master)Maestro Files:
programs/Network Drive Launcher/getServerURL.m:25: failed assertion
`err == noErr'
Network Drive Launcher has exited due to signal 6 (SIGABRT).
***<< This is how I get the the "file://localhost... paths from
the "Finder"
tell application "Finder"
set theFileURL to URL of disk "MYVIDEOS"
end tell
On Aug 10, 2007, at 6:01 AM, Quinn wrote:
.
<<Objective-C method>>
- (NSString *) urlStringForServerVolume:(const char *) path
{
OSStatus err;
FSRef ref;
FSCatalogInfo catInfo;
CFURLRef url;
CFStringRef str;
NSString * result;
assert(path != NULL);
err = FSPathMakeRef( (const UInt8 *) path, &ref, NULL);
assert(err == noErr);
err = FSGetCatalogInfo(&ref, kFSCatInfoVolume, &catInfo,
NULL, NULL, NULL);
assert(err == noErr);
err = FSCopyURLForVolume(catInfo.volume, &url);
assert(err == noErr);
str = CFURLGetString(url);
assert(str != NULL);
result = [NSString stringWithString:(NSString *) str];
assert(result != nil);
CFRelease(url);
return result;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden