Relative path for .torrent file is not supported (Windows)
When trying to create torrent_info from .torrent file using relative path, i.e. ../alice.torrent, libtorrent responds with error with some shady description: Invalid argument [generic 22]
It seems only Windows is affected, because bug is in canonicalization code.
.. and . folders do not exist on windows. And it is ..\alice.torrent for windows.
I do not get it? What is ../alice.torrent, is that some file inside some other .torrent file?
No, it's path to torrent file.
libtorrent uses UNC paths on windows. This is the only way to lift file name length restrictions as well as some other restrictions. As a security feature, windows does not allow relative paths or absolute paths that include ...
It's actually a pretty reasonable stance I think. Instead of relying on a global variable (the current working directory), you should resolve your relative path to an absolute one. The risks of relying on the current working directory is that any part of the program can change it at any time.
Relative directories are more reliable, I think. You can isolate your working directory and move it anywhere without reconfiguration. .. path might have security issues indeed but it's up to system administrator, not for the library to decide what's the best.
As for UNC, you could allow both options. Legacy paths for inter system compatibility and UNC for additional Windows features.
can isolate your working directory and move it anywhere without reconfiguration.
Not on windows. Regedit declares absolute paths for % % and even on Linux ld needs to be present in some specific place and there are requirements for usr sbin lib folders. Also why would you want to do it if you can hard link and move to a different drive, on Windows stuff is always mounted so you can do it even on a different drive.
Finally I use Windows terminal and almost always use absolute paths, unless the app requires THAT its shared LIBRARIES be in ./ when executed.
Not sure how regedit or ld are relevant here. We are talking about where to take user's torrent file and it is completely different from system specific paths.
if you can hard link and move to a different drive
It is unusual to do so for average Windows user. Much easier is to put .torrent file aside with .exe and run.
Finally I use Windows terminal and almost always use absolute paths
Well it's not everyone's typical behavior. I don't think it's a good idea to force people to use absolute paths without really good reason.