When creating a new document for a non-existing file from the command line, check if we don't already have opened it and simply show the existing one if we do. This avoids creating new documents that will be saved to the same location again and again.
Closes https://bugs.launchpad.net/linuxmint/+bug/1482558 You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/646
-- Commit Summary --
* Don't open more than one document for non-existing paths from the CLI
-- File Changes --
M src/libmain.c (6)
-- Patch Links --
https://github.com/geany/geany/pull/646.patch https://github.com/geany/geany/pull/646.diff
--- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/646
Don't understand the problem description. If it is a document that doesn't exist, how can we have opened it already?
--- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/646#issuecomment-138585261
```console $ geany /tmp/nonexistant & $ geany /tmp/nonexistant & ``` results in 2 documents opened, both with `doc->file_name` set to */tmp/nonexistant*. So when you save 'em, you save the same file, yet you have 2 separate documents.
Basically this change gives the same behavior as if you saved the file before trying to open it a second time.
--- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/646#issuecomment-138587281
@b4n does this fix #609 and/or #610? sounds like similar problems, especially #610.
--- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/646#issuecomment-138732100
@b4n ahh, ok, its if you create the same file twice without saving it rather than open it :)
@codebrainz I don't think it will fix either, #609 is files with different names, so this won't apply, #610 is on save not on open so again this won't apply.
--- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/646#issuecomment-138735420
@codebrainz no it won't fix those, but it's indeed very similar to #610.
@elextr yeah, creating the same file, not opening it. I can s/open/create/ in the description if it's less confusing :)
--- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/646#issuecomment-138989374
Merged #646.
--- Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/646#event-434498437
github-comments@lists.geany.org