Exemple #1
0
        public void NormalizePath_Equal(string input, string expected)
        {
            var separator = Path.DirectorySeparatorChar;

            expected = expected.Replace("/", $"{separator}");

            var result = BemolUtil.NormalizePath(input);

            Assert.Equal(result, expected);
        }
        internal string GetTargetPath(string path)
        {
            var currentDirectory = System.AppDomain.CurrentDomain.BaseDirectory;
            var staticFolder     = BemolUtil.NormalizePath(Config.StaticFolder);
            var requestPath      = BemolUtil.NormalizePath(path);
            var separator        = Path.DirectorySeparatorChar;

            if (!requestPath.Contains('.'))
            {
                requestPath += $"{separator}index.html";
            }
            return($"{currentDirectory}{staticFolder}{separator}{requestPath}");
        }