/// <summary>
        /// Gets the base path
        /// </summary>
        /// <returns></returns>
        protected static string GetBasePath()
        {
            var location = Assembly.GetExecutingAssembly().Location;
            var segments = location.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries).ToList();
            var basePath = string.Join(Path.DirectorySeparatorChar.ToString(), segments.Take(segments.Count - 2));

            if (!OperatingSystem.IsWindows())
            {
                basePath = $"/{basePath}";
            }

            return(basePath);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the base path
        /// </summary>
        /// <returns></returns>
        protected string GetBasePath()
        {
            var location = Assembly.GetExecutingAssembly().Location;
            var segments = location.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries).ToList();
            var basePath = string.Join(Path.DirectorySeparatorChar.ToString(), segments.Take(segments.Count - 2));

            if (!OperatingSystem.IsWindows())
            {
                basePath = $"/{basePath}";
            }
#if NET461
            var scriptRootPath = this.Config.GetValue <string>("AzureWebJobsScriptRoot");
            if (!string.IsNullOrWhiteSpace(scriptRootPath))
            {
                basePath = scriptRootPath;
            }
#endif
            return(basePath);
        }