Skip to content

Trailing slashes not stripped from cache path

The source says:

^edded64 source/acfg.cc (Eduard Bloch   2014-05-03 21:22:17 +0200  752)    // get rid of duplicated and trailing slash(es)
^edded64 source/acfg.cc (Eduard Bloch   2014-05-03 21:22:17 +0200  753)         for(tStrPos pos; stmiss != (pos = cachedir.find(SZPATHSEP SZPATHSEP )); )
^edded64 source/acfg.cc (Eduard Bloch   2014-05-03 21:22:17 +0200  754)                 cachedir.erase(pos, 1);
^edded64 source/acfg.cc (Eduard Bloch   2014-05-03 21:22:17 +0200  755) 
^edded64 source/acfg.cc (Eduard Bloch   2014-05-03 21:22:17 +0200  756)         cacheDirSlash=cachedir+CPATHSEP;

But in fact, that only strips double slashes, not trailing slashes.

Suggested change:

diff --git a/src/acfg.cc b/src/acfg.cc
index a137ac2..c351251 100644
--- a/src/acfg.cc
+++ b/src/acfg.cc
@@ -752,6 +752,8 @@ void PostProcConfig()
    // get rid of duplicated and trailing slash(es)
        for(tStrPos pos; stmiss != (pos = cachedir.find(SZPATHSEP SZPATHSEP )); )
                cachedir.erase(pos, 1);
+       if(cachedir.length() > 1)
+               stripSuffix(cachedir, SZPATHSEP);
 
        cacheDirSlash=cachedir+CPATHSEP;