• Cyril Brulebois's avatar
    lint_po: make each i18nspector work with a specific rply cache dir (Closes: #17359). · d7ca5acd
    Cyril Brulebois authored
    Treating the first PO file as special was a nice try but some files
    don't trigger the creation of a parser, i.e. don't result in the
    creation of a rply cache directory and/or cache file.
    
    That's the case if the first file is wiki/src/getting_started.fr.po for
    example, which results in various failure modes, depending on who wins
    the race:
     - mkdir on the just-created rply directory;
     - trying to read from the just-created and still-empty cache file,
       which is not valid JSON-wise;
     - trying to read from a being-written cache file, leading to
       inconsistent data, meaning another JSON validity problem.
    
    Therefore, consider the XDG_CACHE_HOME environment variable set at the
    top-level to be the top-level directory, below which a specific
    subdirectory will be created for each i18nspector call. This should
    ensure nobody steps on someone else's toes.
    
    This is just an attempt at a minimal bug fix, follow-up commits will
    simplify that code drastically.
    d7ca5acd