Skip to content

Commit

Permalink
Merge pull request KSP-CKAN#2 from pjf/netcache
Browse files Browse the repository at this point in the history
We can make IsCached much shorter, right?
  • Loading branch information
AlexanderDzhoganov committed Nov 8, 2014
2 parents 91f0df1 + 889ff14 commit e316bff
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions CKAN/CKAN/NetFileCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,9 @@ public bool IsCached(Uri url)
// returns the filename in the outFilename parameter
public bool IsCached(Uri url, out string outFilename)
{
var hash = CreateURLHash(url);
outFilename = GetCachedFilename(url);

foreach (var file in Directory.GetFiles(cachePath))
{
var filename = Path.GetFileName(file);
if (filename.StartsWith(hash))
{
outFilename = file;
return true;
}
}

outFilename = "";
return false;
return outFilename != null;
}

// returns the filename of an already cached url or null otherwise
Expand Down

0 comments on commit e316bff

Please sign in to comment.