Skip to content

Comments

Fix multi-instance file path passing#852

Merged
dail8859 merged 2 commits intodail8859:masterfrom
coladict:fix-multiinstance-paths
Aug 23, 2025
Merged

Fix multi-instance file path passing#852
dail8859 merged 2 commits intodail8859:masterfrom
coladict:fix-multiinstance-paths

Conversation

@coladict
Copy link
Contributor

@coladict coladict commented Aug 17, 2025

I tried opening a file through the console while I had an instance running, but the primary instance looked for it in its own working directory.

Not sure if this code is up to standard, but it works on Ubuntu 24. I haven't written in C++ in about 13 years.

@dail8859
Copy link
Owner

Thanks for the PR!

Could you provide a set of steps of the issue you are having? That way I can verify the code changes and try to reproduce it on Windows.

@dail8859
Copy link
Owner

Also on the primary instance if you open the Help > Debug Log it will show what it is getting sent which might be helpful to see what is getting sent across.

@coladict
Copy link
Contributor Author

coladict commented Aug 17, 2025

Steps to reproduce issue:

  1. Open NotepadNext from launcher (runs with home directory as work directory)
  2. In any terminal go to directory other than home.
  3. Attempt to open file from that directory, eg NotepadNext main.cpp
  4. It will open "main.cpp" in the home directory, instead of the current one for the original invocation.

@dail8859
Copy link
Owner

👍

@coladict
Copy link
Contributor Author

Log from the affected version:

[     8.560] I: void NotepadNextApplication::receiveInfoFromSecondaryInstance(quint32, QByteArray)
[     8.561] I: void NotepadNextApplication::openFiles(const QStringList&)
[     8.561] I: void MainWindow::openFileList(const QStringList&)
[     8.561] I: 01.sql
[     8.561] D: Read 0 bytes

Log from this version (with the home name censored):

[     5.677] I: void NotepadNextApplication::receiveInfoFromSecondaryInstance(quint32, QByteArray)
[     5.677] I: void NotepadNextApplication::openFiles(const QStringList&)
[     5.677] I: void MainWindow::openFileList(const QStringList&)
[     5.677] I: /home/user/db-update-scripts/3.12.0/01.sql
[     5.678] D: Read 248 bytes

@dail8859 dail8859 merged commit bfd5742 into dail8859:master Aug 23, 2025
12 checks passed
@coladict
Copy link
Contributor Author

Frankly the change to use a Set instead of the list was unnecessary. If you ever have a command line with enough files that you can measure a performance improvement, you're using it wrong.

@dail8859
Copy link
Owner

Honestly you are completely right. I was testing out some other things with that at the time and tried to wrap it up late at night and definitely the way it is implemented is not ideal for the 99.99% case. I tend to not trust user input but as a certain point you just tell the user "don't do that".

@dail8859
Copy link
Owner

993120a

matthewyang204 pushed a commit to matthewyang204/NotepadNext that referenced this pull request Dec 14, 2025
---------

Co-authored-by: Yordan Gigov <[email protected]>
Co-authored-by: dail8859 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants