Skip to content

Commit

Permalink
[Enhancement] Show error message for non-existent destination path
Browse files Browse the repository at this point in the history
  • Loading branch information
arnobpl committed Jun 14, 2023
1 parent bb74552 commit 6b594a8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions SymlinkCreator/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("1.2.1")]
[assembly: AssemblyFileVersion("1.2.1")]
[assembly: AssemblyVersion("1.2.2")]
[assembly: AssemblyFileVersion("1.2.2")]
3 changes: 1 addition & 2 deletions SymlinkCreator/core/SymlinkAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ public void CreateSymlinks()
// check for destination path
if (!Directory.Exists(_destinationPath))
{
Debug.WriteLine("Destination path does not exist: " + _destinationPath);
return;
throw new FileNotFoundException("Destination path does not exist", _destinationPath);
}

// remove the last '\' character from the path if exists
Expand Down
12 changes: 9 additions & 3 deletions SymlinkCreator/ui/mainWindow/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,15 @@ private void CreateSymlinksButton_OnClick(object sender, RoutedEventArgs e)
mainWindowViewModel.ShouldUseRelativePath,
mainWindowViewModel.ShouldRetainScriptFile);

symlinkAgent.CreateSymlinks();

MessageBox.Show("Execution completed.", "Done!", MessageBoxButton.OK, MessageBoxImage.Information);
try
{
symlinkAgent.CreateSymlinks();
MessageBox.Show("Execution completed.", "Done!", MessageBoxButton.OK, MessageBoxImage.Information);
}
catch (FileNotFoundException ex)
{
MessageBox.Show(ex.Message + ":\n" + ex.FileName, "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
}
}

private void AboutButton_OnClick(object sender, RoutedEventArgs e)
Expand Down

0 comments on commit 6b594a8

Please sign in to comment.