/// <summary> /// Get directory path for backs /// </summary> /// <param name="ensureFolderCreated">A value indicating whether a directory should be created if it doesn't exist</param> /// <returns></returns> protected virtual string GetBackupDirectoryPath(bool ensureFolderCreated = true) { var path = _fileProvider.GetAbsolutePath(SmiCommonDefaults.DbBackupsPath); if (ensureFolderCreated) { _fileProvider.CreateDirectory(path); } return(path); }
/// <summary> /// Get picture (thumb) local path /// </summary> /// <param name="thumbFileName">Filename</param> /// <returns>Local picture thumb path</returns> protected virtual string GetThumbLocalPath(string thumbFileName) { var thumbsDirectoryPath = _fileProvider.GetAbsolutePath(SmiMediaDefaults.ImageThumbsPath); if (_mediaSettings.MultipleThumbDirectories) { //get the first two letters of the file name var fileNameWithoutExtension = _fileProvider.GetFileNameWithoutExtension(thumbFileName); if (fileNameWithoutExtension != null && fileNameWithoutExtension.Length > SmiMediaDefaults.MultipleThumbDirectoriesLength) { var subDirectoryName = fileNameWithoutExtension.Substring(0, SmiMediaDefaults.MultipleThumbDirectoriesLength); thumbsDirectoryPath = _fileProvider.GetAbsolutePath(SmiMediaDefaults.ImageThumbsPath, subDirectoryName); _fileProvider.CreateDirectory(thumbsDirectoryPath); } } var thumbFilePath = _fileProvider.Combine(thumbsDirectoryPath, thumbFileName); return(thumbFilePath); }