bugGNUstep - Bugs: bug #19098, NSDocumentController: documents...


You are not allowed to post comments on this tracker with your current authentication level.

bug #19098: NSDocumentController: documents can open twice in same app (easy to fix)

Submitted by:  Günther Noack <guenthernoack>
Submitted on:  Mon 19 Feb 2007 06:30:21 PM UTC  
Category:  Gui/AppKit Severity:  3 - Normal
Item Group:  Bug Status:  In Progress
Privacy:  Public Assigned to:  Gregory John Casamento <gcasa>
Open/Closed:  Open

Mon 23 Feb 2015 09:19:50 AM UTC, comment #3:

Greg, since you confirmed that Cocoa does "solve" this problem and Guenther says that Appe explicitely says it doesn't resolve symlinks in NSDocument, is the correct way to resolve this a fix in GWorkspace, that should resolve the "argument" before opening the corresponding app?
Or is apple lying? how can we verify this?

Riccardo Mottola <rmottola>
Project Member
Mon 03 Sep 2007 07:15:05 PM UTC, comment #2:

Confirmed. It does work this way under Cocoa. My test case was this:

1) Create a directory (mine was Temp1)
2) Open TextEdit (or any document oriented app)
3) Create a document under the directory created in #1,
4) Create a link to the directory
5) Open the same document again via the link.

On Cocoa: the document refuses to open again, as you described.
On GNUstep: the document does open again....

Thanks for the bug report.


Gregory John Casamento <gcasa>
Project AdministratorIn charge of this item.
Sat 19 May 2007 03:51:01 PM UTC, comment #1:

I would be interested to see if Mac OS X shows this same behavior.

Gregory John Casamento <gcasa>
Project AdministratorIn charge of this item.
Mon 19 Feb 2007 06:30:21 PM UTC, original submission:

When opening a document in a NSDocument-based application, it's possible to open a document in two different document windows at once by using different workflows "instance" 1 and 2 of the document:

a) double clicking it in GWorkspace
b) opening it using the "Document/Open..." dialog

Comparing the used path name, it's one time /home/guenther/Desktop/Test.rtf (when using GWorkspace) and it's one time /usr/home/guenther/Desktop/Test.rtf (when using the open panel). So the problem only applies when a parent directory of the file is symlinked.

This can be fixed by calling -stringByResolvingAllSymlinksInPath on the file name somewhere. In NSDocument.m, line 405 (GNUstep-stable), there's a note that Apple doesn't do this, but I find it hard to believe Apple also fails at this issue. (I can't verify it.) In case Apple really doesn't do it, this would probably be a place where GNUstep can be better. ;-)

There are two ways to solve the problem. It's all about where to place that call.

  • In GWorkspace: If Apple doesn't replace symlinks when opening files, which I highly doubt, this is probably how they do it.
  • In NSDocument & NSDocumentController: In NSDocument, normalize the file name when setting it for the first time. In NSDocumentController, in openDocumentWithContentsOfFile:display: and openDocumentWithContentsOfURL:display:, normalize it as well. (BTW, in the latter the check if a URL has been opened twice also doesn't work for non-file:// URLs)
Günther Noack <guenthernoack>


No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rmottola (Posted a comment)
  • -email is unavailable- added by gcasa (Posted a comment)
  • -email is unavailable- added by guenthernoack (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-05-19 gcasa StatusNone => In Progress
        Assigned toNone => gcasa

    Back to the top

    Powered by Savane 3.3