Skip to content

Commit

Permalink
Added documents path validation
Browse files Browse the repository at this point in the history
  • Loading branch information
vnvizitiu committed Dec 2, 2016
1 parent 4d1c511 commit 3365d76
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
/FileSystemSyncher/FileSystemSyncher.Tests/bin/Debug
/FileSystemSyncher/packages/FluentAssertions.4.12.0
/FileSystemSyncher/packages/NUnit.2.6.0.12054
/FileSystemSyncher/_ReSharper.Caches/ReSharperPlatformVs146.FileSystemSyncher.00
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ public class ConfigurationOptions
{
public ConfigurationOptions(string sourceDirectory, string destinationDirectory)
{
string sourceFullPath = Path.GetFullPath(sourceDirectory);
string sourceFullPath = Path.GetFullPath(sourceDirectory).TrimEnd('\\');
SourceDirectory = new DirectoryInfo(sourceFullPath);
if (!SourceDirectory.Exists)
throw new ConfigurationErrorsException("The folder in the source path does not exist");

DestinationDirectory = new DirectoryInfo(destinationDirectory);
string destinationPath = destinationDirectory;
if (!string.IsNullOrWhiteSpace(destinationDirectory))
{
destinationPath = destinationPath.TrimEnd('\\');
}

DestinationDirectory = new DirectoryInfo(destinationPath);
}

public DirectoryInfo SourceDirectory { get; }
Expand Down

0 comments on commit 3365d76

Please sign in to comment.