Open life00 opened 7 months ago
I couldn't get --new-window to work and this post explained why (thanks @life00!). I'm on Windows 11 and giving a relative path to a PDF from powershell using command A below makes the sioyek icon in the taskbar blink, but does not open any new window nor does it open the document provided in the argument. But giving the absolute path as in command B works.
A PS C:\path to directory with pdf> & 'C:\long path with spaces\sioyek-release-windows-portable\sioyek-release-windows\sioyek.exe' --new-window '.\pdf filename (with spaces and special characters).pdf'
B PS C:\path to directory with pdf> & 'C:\long path with spaces\sioyek-release-windows-portable\sioyek-release-windows\sioyek.exe' --new-window 'c:\path to directory with pdf\pdf filename (with spaces and special characters).pdf'
I recently noticed a weird inconsistency when trying to open PDF files as new window with
--new-window
argument and also supplying the relative path to Sioyek. The problem was that it failed to recognize that relative path correctly.I identified the reason and I am not completely sure if its a bug or it is on purpose. Here is how you can reproduce it
a.pdf
in directory/files/
as the initial file with the commandsioyek --new-window a.pdf
(while I am inside/files/
) that launches Sioyek.b.pdf
as another window but it is in directory/files/dir/
to which I previously navigate, so I runsioyek --new-window b.pdf
(while being in/files/dir/
)The initial instance of sioyek will be supplied with this new path to file, however it will fail to open it because it is appending the relative path (being
./b.pdf
) to the current working directory of the initial instance (being/files/
), not the new temporary instance CWD, so it tries to open/files/b.pdf
and fails.The fact that I am still able to open PDF files inside of CWD of initial instance as new window confirms this theory (e.g. I can open
c.pdf
inside/files/
because it does not trigger the bug).There is no issue when Sioyek is supplied with the full path to
b.pdf
, so it is not that critical, however I believe relative paths should still be handled correctly and that's why I report this issue.