aitjcize / cppman

C++ 98/11/14 manual pages for Linux/MacOS
GNU General Public License v3.0
1.27k stars 79 forks source link

Put cache checking before actual download #35

Closed zopieux closed 9 years ago

zopieux commented 9 years ago

As of HEAD, when using --cache-all, cppman first downloads the source page and then checks if it was already in the filesystem (or if update was forced). This makes no sense, since the purpose of a cache is to prevent useless downloads.

This PR move the cache check just a few lines up, so it does not download if there no need to. AFAIK this is the right behavior, please tell me if I got something wrong.


I also moved gzip open/write/close to a with statement, that are cleaner and more pythonic.


The reverse or condition is just to prevent a useless linear in-search if forced is true. Yes, this is a pretty desperate optimization but hey. :smile:

aitjcize commented 9 years ago

Yes, that make sense, thanks :)