Make CDirectory::Exists support use directory cache by default. #2496

Merged
merged 1 commit into from Apr 8, 2013

Projects

None yet

4 participants

@ulion

We check file exists in CFile::Open() and CFile::Exists() for files, but not for dir in CDirectory::Exists() yet, this PR make CDirectory::Exists() also use directory cache to speed up the Exists operation.

@jmarshallnz
Team Kodi member

Looks OK to me once rebased up.

@ulion

rebased.

@MartijnKaijser MartijnKaijser merged commit 33a0d63 into xbmc:master Apr 8, 2013
@Montellese

This causes a problem with changing the GUI language during runtime. CLocalizeStrings::LoadStr2Mem() calls CDirectory::Exists() with the path of the directory of the new language. g_directoryCache.FileExists() returnes false but bPathInCache returns true so the next if-condition fails and returns false.

EDIT: Seems like the problem is using g_directoryCache.FileExists() with a path to a directory as it expects a path to a file. It removes the file and checks the existance of its parent directory in the cache. But when you pass in a directory path, it removes the top-most directory and checks its parent path, which is cached. But the file cache only stores files and not directories so bPathInCache becomes false.
TBH I'm wondering how this works anywhere with directories.

Team Kodi member

My bet is it's stored slash at end and looked up without (or vice-versa).

the requested dir doesn't ends with slash. but since we are calling CDirectory::Exists here, I will try to add the end slash to the dir to see whether it can be fixed by this.

Fixed in: #2608

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment