URL:
  <http://savannah.gnu.org/bugs/?19098>

                 Summary: NSDocumentController: documents can open twice in
same app (easy to fix)
                 Project: GNUstep
            Submitted by: guenthernoack
            Submitted on: Monday 19/02/07 at 18:30
                Category: Gui/AppKit
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

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)






    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?19098>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-gnustep mailing list
Bug-gnustep@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to