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

Group
 
 

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

Submitter:  Günther Noack <guenthernoack>
Submitted:  Mon 19 Feb 2007 06:30:21 PM UTC
   
 
Category:  Gui/AppKit Severity:  3 - Normal
Item Group:  Bug Status:  Wont Fix
Privacy:  Public Assigned to:  gcasa
Open/Closed:  Declined
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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.

GJC

Gregory John Casamento <gcasa>
Group administrator
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>
Group administrator
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>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

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)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-04-22 gcasa StatusIn Progress Wont Fix
        Open/ClosedOpen Declined
    2007-05-19 gcasa StatusNone In Progress
        Assigned toNone gcasa

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code