Skip to content

Commit

Permalink
NetKAN: Log which curl-ca bundle we use as an Info message.
Browse files Browse the repository at this point in the history
For #1052
  • Loading branch information
pjf committed Jun 21, 2015
1 parent 0db1344 commit 2d8ef35
Showing 1 changed file with 20 additions and 23 deletions.
43 changes: 20 additions & 23 deletions Netkan/Web.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,35 +81,32 @@ public void Dispose()
/// <returns>The absolute file path to the bundle file or null if none is found.</returns>
private static string ResolveCurlCaBundle()
{
if (Platform.IsWindows)
{
const string caBundleFileName = "curl-ca-bundle.crt";
const string ckanSubDirectoryName = "CKAN";
const string caBundleFileName = "curl-ca-bundle.crt";
const string ckanSubDirectoryName = "CKAN";

return new[]
{
// Working Directory
Environment.CurrentDirectory,
string bundle = new[]
{
// Working Directory
Environment.CurrentDirectory,

// Executable Directory
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
// Executable Directory
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),

// %LOCALAPPDATA%/CKAN
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), ckanSubDirectoryName),
// %LOCALAPPDATA%/CKAN
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), ckanSubDirectoryName),

// %APPDATA%/CKAN
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ckanSubDirectoryName),
// %APPDATA%/CKAN
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ckanSubDirectoryName),

// %PROGRAMDATA%/CKAN
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), ckanSubDirectoryName),
}
.Select(i => Path.Combine(i, caBundleFileName))
.FirstOrDefault(File.Exists);
}
else
{
return null;
// %PROGRAMDATA%/CKAN
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), ckanSubDirectoryName),
}
.Select(i => Path.Combine(i, caBundleFileName))
.FirstOrDefault(File.Exists);

log.InfoFormat("Using curl-ca bundle: {0}",bundle ?? "(none)");

return bundle;
}
}
}
Expand Down

0 comments on commit 2d8ef35

Please sign in to comment.