Skip to content

Commit

Permalink
Merge pull request #677 from minaLogi/main
Browse files Browse the repository at this point in the history
プロジェクト/シーン作成時の名前の判定についての修正
  • Loading branch information
yuto-trd authored Aug 27, 2023
2 parents 1a52819 + 5339e64 commit ef8f80f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Beutl/ViewModels/Dialogs/CreateNewProjectViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public CreateNewProjectViewModel()

Name.SetValidateNotifyError(n =>
{
if(n == string.Empty || n == null)
if(n == string.Empty || n == null || n.IndexOfAny(Path.GetInvalidFileNameChars()) > -1)
{
return Message.InvalidString;
}
Expand Down
13 changes: 11 additions & 2 deletions src/Beutl/ViewModels/Dialogs/CreateNewSceneViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ public CreateNewSceneViewModel()

Name.SetValidateNotifyError(n =>
{
if (Directory.Exists(Path.Combine(Location.Value, n)))
if (n == string.Empty || n == null || n.IndexOfAny(Path.GetInvalidFileNameChars()) > -1)
{
return Message.InvalidString;
}
else if (Directory.Exists(Path.Combine(Location.Value, n)))
{
return Message.ItAlreadyExists;
}
Expand Down Expand Up @@ -51,9 +55,14 @@ public CreateNewSceneViewModel()
string location = t.Second;
PixelSize size = t.Third;
return !Directory.Exists(Path.Combine(location, name)) &&
if (location != null && name != null)
{
return !Directory.Exists(Path.Combine(location, name)) &&
size.Width > 0 &&
size.Height > 0;
}
else return false;
}).ToReadOnlyReactivePropertySlim();
Create = new ReactiveCommand(CanCreate);
Create.Subscribe(() =>
Expand Down

0 comments on commit ef8f80f

Please sign in to comment.