• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Help! Open File always returns YES
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help! Open File always returns YES


  • Subject: Re: Help! Open File always returns YES
  • From: Ondra Cada <email@hidden>
  • Date: Fri, 15 Mar 2002 15:52:28 +0100

On Friday, March 15, 2002, at 03:40 , John McGruer wrote:

result = [[NSWorkspace sharedWorkspace] openFile:helpFilePath_1
withApplication:@"Preview"];

The problem is that "result" is always YES even though the help file does
not exist yet! shouldn't "result = NO if the file does not exist? How to get
around this problem? Many thanks


I am afraid it won't be possible, since the thing is AFAIK asynchronous: the method returns ages before the application really tries to open the file.

With Cocoa applications which use representedFilename properly you can hack in to get the application's window list and check, but it's kinda dirty, and would not work for Carbon (nor apps which don't use setRepresentedFilename: properly).

PS If I use this form:

result = [[NSWorkspace sharedWorkspace] openFile:helpFilePath_2];

"result" still = YES but Internet Explorer is launched, even though
helpFilePath_2 is a .pdf file!! What gives?

Dunno for sure, but might there be some blasted Classic remnant of a (IE) creator code?
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
2K Development: email@hidden http://www.2kdevelopment.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Help! Open File always returns YES (From: John McGruer <email@hidden>)

  • Prev by Date: Re: Subclass NSCell
  • Next by Date: Re: Command + Delete Key Equivalent
  • Previous by thread: Help! Open File always returns YES
  • Next by thread: What may be wrong?
  • Index(es):
    • Date
    • Thread