I have link in a rst file that refers to a local file, which will be in a path dependant on user name, such as:
`The link to my file <file:///C:\\Users\\USERNAME\\AppData\\Local\\Apps\\myfile.html>`_
I am on a Windows OS, and this is a typical path that can be accessed with %APPDATA% in Explorer.
I would like to provide the link with something like:
`The link to my file <file:///%APPDATA%\\Apps\\myfile.html>`_
My try with %APPDATA% did not work. How should I do?
Edit: corrected %APPDATA% (added % at the variable end) and added _ at the end of the hyperlinks. However, that does not solve the real problem: the browser does not interpret / extend %APPDATA% so it answers "file not found".
In short: this is not possible
A workaround is to provide the link with %APPDATA% included and tell the user to copy-paste it into a Windows Explorer. So in rst:
To open 'the file', please copy-paste the following link into a Windows Explorer:
`file:///%APPDATA%\\Apps\\myfile.html`
In details:
From comments of mzdn and G. Milde.
From related: superuser.com/q/807835 (provided by @mzjn)
file:// was deprecated greatly many years ago, due to the security implications of allowing a remote site ANY access to your file system.
So, it turns out to be a problem of HTML hyperlinking, not reStructuredText.
I guess the answer is then... this in not possible, tell the user to copy-paste %APPDATA%\Apps\myfile.html into a Windows Explorer.