diff --git a/RainmeterStudio.Core/Utils/PathHelper.cs b/RainmeterStudio.Core/Utils/PathHelper.cs
index 0323365a..0322815a 100644
--- a/RainmeterStudio.Core/Utils/PathHelper.cs
+++ b/RainmeterStudio.Core/Utils/PathHelper.cs
@@ -21,5 +21,23 @@ namespace RainmeterStudio.Core.Utils
return true;
}
+
+ ///
+ /// Validates a file name
+ ///
+ /// Name of file
+ ///
+ public static bool IsFileNameValid(string name)
+ {
+ // No name is not a valid name
+ if (String.IsNullOrEmpty(name))
+ return false;
+
+ // Check for invalid characters
+ if (Path.GetInvalidFileNameChars().Intersect(name).Any())
+ return false;
+
+ return true;
+ }
}
}
diff --git a/RainmeterStudio/UI/Dialogs/CreateProjectDialog.xaml.cs b/RainmeterStudio/UI/Dialogs/CreateProjectDialog.xaml.cs
index edde29b8..b2d50d9f 100644
--- a/RainmeterStudio/UI/Dialogs/CreateProjectDialog.xaml.cs
+++ b/RainmeterStudio/UI/Dialogs/CreateProjectDialog.xaml.cs
@@ -113,9 +113,7 @@ namespace RainmeterStudio.UI.Dialogs
// Populate controls
listTemplates.ItemsSource = projectController.ProjectTemplates.OrderBy(x => x.DisplayText);
-
textLocation.ItemsSource = GetRecentLocations().OrderBy(x => x);
-
textLocation.Text = GetLocation();
Validate();
@@ -145,8 +143,10 @@ namespace RainmeterStudio.UI.Dialogs
private void Validate()
{
bool res = true;
- res &= (listTemplates.SelectedItem != null);
-
+ res &= (listTemplates.SelectedItem != null);
+ res &= PathHelper.IsFileNameValid(textName.Text);
+ res &= PathHelper.IsPathValid(textLocation.Text);
+
buttonCreate.IsEnabled = res;
}