Skip to content

Commit

Permalink
Core - Add DependencyChecker.AssertPathAbsolute
Browse files Browse the repository at this point in the history
Issue #3102
  • Loading branch information
amaitland committed May 1, 2020
1 parent d82370e commit 46006b4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions CefSharp/DependencyChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,5 +224,24 @@ public static void AssertAllDependenciesPresent(string locale = null, string loc
throw new Exception(builder.ToString());
}
}

/// <summary>
/// Throw exception if the path provided is non-asbolute
/// CEF now explicitly requires absolute paths
/// https://bitbucket.org/chromiumembedded/cef/issues/2916/not-persisting-in-local-stoage-when-using
/// </summary>
/// <param name="path">path</param>
/// <param name="settingName">string to appear at the start of
/// the exception, e.g. CefSettings.BrowserSubProcessPath</param>
public static void AssertPathAbsolute(string path, string settingName)
{
const string directorySeperator = "\\";

//IsPathRooted will return true for paths that start with a single slash, e.g. \programfiles
if (!Path.IsPathRooted(path) || Path.GetPathRoot(path).Equals(directorySeperator, StringComparison.Ordinal))
{
throw new Exception(settingName + " now requires an absolute path, the path provided is non-absolute: " + path);
}
}
}
}

0 comments on commit 46006b4

Please sign in to comment.