Fixing get_version function on Windows

Hey Fox,

I’d like you to make some changes in get_version function (include\functions.php) to support non-docker Windows host.
I tested some of your code on my config (Windows 10 x64, latest git pull origin master):
1.

if (‘\’ === DIRECTORY_SEPARATOR) { $ttrss_version[‘version’] = “UNKNOWN (Unsupported, Windows)”;

This condition is always true so It will not check version but write “UNKNOWN” right away.
2.
In

exec('git…

you use php function escapeshellarg which has different meaning on Windows:

On Windows, escapeshellarg() instead replaces percent signs, exclamation marks (delayed variable substitution) and double quotes with spaces and adds double quotes around the string.
(from php manual)

So to make get_version working on my windows machine I had to remove DIRECTORY_SEPARATOR check and replace escapeshellarg with double quotes

.‘“version: %ct %h”’.

I hope this will help you to make changes in your repository.

Best regards

Fox will no doubt also address this, but consider:

[Emphasis mine.] You want changes made to TT-RSS to better support something that is not supported.

(Also, if you have the code changes already done, the correct course of action is to submit a pull request and let fox accept/reject it.)

[Emphasis mine.] You want changes made to TT-RSS to better support something that is not supported.

Can you point where on website (tt-rss.org) is stated that Windows as host is not supported?

I only highlighted changes which I made to help develop wider solution.

it isn’t. that’s all there is to it.

If you’d consider a PR, I’ll file it. I’m one of those stupid bastards running unsupported on Windows (and have for nearly 10 years). It doesn’t look like it would mess much up but won’t waste our times if you are not interested.

Thanks as always &
Cheers,

Toby

sure, if the required change is self-contained like above, i don’t see any problem with merging it.

'Tis done. Thanks &
Cheers,

Toby

Thanks fox, works perfectly

Screen Shot 2020-03-03 at 11.18.53 AM