Fix just inserted crash due to a new assert.

It is a todo to find a better fix, but to don't cause probleme, here is a work around.
Set the file in the compiledir, not the case. Some user set the compiledir directly, not the base_compiledir and this make that sometimes, the base_compiledir isn't working.
Merge pull request #1203 from nouiz/fix_cachelock

Fix cachelock