public FileSystemStorageProvider(IConfigurationProvider <FileSystemSettings> provider) { this.settings = provider.Settings; var mediaPath = HostingEnvironment.IsHosted ? HostingEnvironment.MapPath("~/Media/") ?? "" : Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Media"); storagePath = Path.Combine(mediaPath, settings.DirectoryName); var appPath = ""; if (HostingEnvironment.IsHosted) { appPath = HostingEnvironment.ApplicationVirtualPath; } if (!appPath.EndsWith("/")) { appPath = appPath + '/'; } if (!appPath.StartsWith("/")) { appPath = '/' + appPath; } var dirPath = string.IsNullOrEmpty(settings.DirectoryName) ? string.Empty : settings.DirectoryName + "/"; publicPath = appPath + "Media/" + dirPath; }
public void Execute() { if (provider.Settings.IsDefaultOrEmpty()) { var settings = FileSystemSettings.Default(); provider.Save(settings); } }