public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context == null || provider == null) { return(base.EditValue(context, provider, value)); } string filePath = value as string; string initialDirectory = null; if (!string.IsNullOrEmpty(filePath)) { filePath = Helpers.ExpandFolderVariables(filePath, true); string directoryPath = Path.GetDirectoryName(filePath); if (!string.IsNullOrEmpty(directoryPath) && Directory.Exists(directoryPath)) { initialDirectory = directoryPath; } } filePath = ImageHelpers.OpenImageFileDialog(null, initialDirectory); if (!string.IsNullOrEmpty(filePath)) { value = Helpers.GetVariableFolderPath(filePath, true); } return(value); }
public static string GetAbsolutePath(string path) { path = Helpers.ExpandFolderVariables(path); if (!Path.IsPathRooted(path)) // Is relative path? { path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path); } return(Path.GetFullPath(path)); }
public string GetFullPath() { return(Helpers.ExpandFolderVariables(Path)); }