Ok. I have an app that parses an XML that contains links to various documents into a TableView. When clicking on the table view row, I would like for the app to check if that file already exists in the NSDocuments folder. If it does, than the subsequent view with a WebView will load that file. If not, then it will download that file, and then load it up. The issue that I am facing right now is that the XML contains some PDF files and some DOC files. I want the app to be able to check for both. How can I do an OR tag in there?
What I have right now is:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *pdfPath = [[documentsDirectory stringByAppendingPathComponent:@"aimprojectdownloads" ] stringByAppendingPathComponent:entry.articleTitle];
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:pdfPath];
if (fileExists) {
//open the already downloaded file
}
if (!fileExists) {
//download and then open
}
entry.articleTitle is just going to equal the name of the article, MINUS the extension of it. But, in the folder where they are all stored, it will have the name and the extension. Will that cause problems?