I'm opening files from Windows Explorer with `Open with Geany`. I found that after a certain number of files are opened, it will launch new Geany instances. Each instance has duplicated opened files with the others, but not all opened files are duplicated. This indicated that there is a threshold for the maximum number of files that can be opened in a single instance of Geany. Or, is it a bug?
There is no limit on the number of files open in an instance of Geany unless somehow Windows is limiting it, there are users who have hundreds of files open.
Sounds more like the interprocess communication in Windows is gumming up, but with no information about exactly what you are doing, the versions of Geany, Windows, etc can't help you and nobody can replicate the problem.
Sorry, I have already done the best I can to describe the problem. I will just accept that Geany is not for handling multiple files.
Closed #3754 as resolved.
Tested on Windows 7 with Geany 2.0 and I can successfully open up to 15 files at once in Windows Explorer by selecting them and use the "Open with Geany" context menu action.
I noticed when selecting more than 15 files, the context menu action "Open with Geany" does not appear anymore. This is probably some Windows limitation or setting we do not set. But probably OK for most users.
@iahung3 can you check if there are any warnings or error in Help->Debug Messages when the described problem occurs? Also can you provide the list of files you are trying to open (maybe add a screenshot of the selected files in Windows explorer)?
What is the difference between this and #3755? The read pretty much the same to me.
@eht16 so you think the problem is opening files at the same time, not the total number open as I thought? I guess it could be, the description is pretty bad.
In that case, is the problem something to do with how explorer opens multiple files? Does it execute a command for each file or one command with all the files passed to it, in which case is the issue one of command length?
Do you have MSYS2 installed on your system? Go to the home directory of MSYS2, select these files to open with Geany: `.bash_history`, `.bash_logout`, `.bash_profile`, `.bashrc`, and `.profile`. It will launch two instances of Geany.
When you opened those files, did you have a Geany instance already open?
@eht16 so you think the problem is opening files at the same time, not the total number open as I thought? I guess it could be, the description is pretty bad.
Yes, I did and yes, the description leaves plenty room for interpretation :(.
In that case, is the problem something to do with how explorer opens multiple files? Does it execute a command for each file or one command with all the files passed to it, in which case is the issue one of command length?
I'm not totally sure but I think to remember that Explorer execute one command and pass all files at once. As said before, I can successfully open up to 15 files at once, the file paths were not too long but I guess even with long paths for 15 files it should still be OK.
Do you have MSYS2 installed on your system? Go to the home directory of MSYS2, select these files to open with Geany: `.bash_history`, `.bash_logout`, `.bash_profile`, `.bashrc`, and `.profile`. It will launch two instances of Geany.
Successfully done: ![Screenshot_2024-02-17_12-26-59](https://github.com/geany/geany/assets/617017/450f4967-2095-4461-85a7-17ad6d2...)
@iahung3 it would be nice if you could answer my questions above, especially the contents of Help->Debug Messages are interesting.
@eht16 It's happening randomly. I can't reproduce it now.
When you opened those files, did you have a Geany instance already open?
No.
Bingo. This is the relevant piece of information and without a running instance of Geany, I could instantly reproduce it.
If there is no instance open, then if windows runs multiple geany commands it will be racey which commands will see that another command is already running and send its file to that and which commands will see no existing instances and run themselves as a new one.
Good guess. I tested this and Windows Explorer in fact spawns a single Geany process per selected file and then this happens what @elextr described above.
There is probably no easy solution. Making the initial startup faster until the socket connection is checked or implementing some other kind of early locking could make it better but there might be still systems or situations where the startup of the first process is slow enough than the second does not yet see the first one.
Maybe Windows Explorer can be told to start one only process and pass all files to it but I don't know whether this is possible.
Yeah, it would need an inter-process lock around the critical section "test for existence of socket and create it if not" which would have to be [windows specific](https://learn.microsoft.com/en-us/windows/win32/sync/interprocess-synchroniz...) code since glib doesn't seem to have any inter-process stuff, just inter-thread. All it needs is a windows developer to contribute.
It works on Linux because the file manager (at least Nemo that I tested) uses one command with lots of filenames.
@iahung3 see, you were able to provide more helpful clarification (that you selected multiple files at once in explorer) and useful information (that it was sometimes random) that helped others to help you, don't give up so easy, try to describe _exactly_ what you did as if you are guiding a new computer user on the other end how to reproduce. :-)
github-comments@lists.geany.org