fileURLWithPath :isDirectory:
Initializes and returns a newly created NSURL object as a file URL with a specified path.
Parameters
- path
- The path that the NSURL object will represent. path should be a valid system path. If pathbegins with a tilde, it must first be expanded with
stringByExpandingTildeInPath
. Ifpath
is a relative path, it is treated as being relative to the current working directory.[NSURL fileURLWithPath]Passingnil
for this parameter produces an exception. - isDir
- A Boolean value that specifies whether path is treated as a directory path when resolving against relative path components. Pass
YES
if the path indicates a directory,NO
otherwise.
Return Value of [NSURL fileURLWithPath]
An NSURL object initialized with path.
Example of [NSURL fileURLWithPath]
[slWebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"iHelp" ofType:@"htm"]isDirectory:NO]]];
Example of [NSURL fileURLWithPath]
NSURL *theURL = [NSURL fileURLWithPath:@"/Users/elisevanlooij/nonexistingfile.php"
isDirectory:NO];
NSError *err;
if ([theURL checkResourceIsReachableAndReturnError:&err] == NO)
[[NSAlert alertWithError:err] runModal];