Skip to content
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.

Commit

Permalink
check for invalid chars in schema path
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Balaji <[email protected]>
  • Loading branch information
Paul Balaji committed May 24, 2019
1 parent 7fea68c commit d919638
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion workers/unity/Assets/Plugins.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using UnityEngine;

Expand Down Expand Up @@ -55,26 +54,32 @@ internal List<string> Validate()
errors.Add($"{GdkToolsConfigurationWindow.DescriptorOutputDirLabel} cannot be empty.");
}

var emptySchemaSourceDir = false;
foreach (var schemaSourceDir in SchemaSourceDirs)
for (var i = 0; i < SchemaSourceDirs.Count; i++)
{
var schemaSourceDir = SchemaSourceDirs[i];

if (!string.IsNullOrEmpty(schemaSourceDir))
{
var fullSchemaSourceDirPath = Path.Combine(UnityProjectRoot, schemaSourceDir);
string fullSchemaSourceDirPath;
try
{
fullSchemaSourceDirPath = Path.Combine(UnityProjectRoot, schemaSourceDir);
}
catch (ArgumentException)
{
errors.Add($"Schema path [{i}] contains one or more invalid characters.");
continue;
}

if (!Directory.Exists(fullSchemaSourceDirPath))
{
errors.Add($"{fullSchemaSourceDirPath} cannot be found.");
}

continue;
}

emptySchemaSourceDir = true;
}

if (emptySchemaSourceDir)
{
errors.Add($"Cannot have any empty entry in {GdkToolsConfigurationWindow.SchemaSourceDirsLabel}.");
else
{
errors.Add($"Schema path [{i}] is empty. You must provide a valid path.");
}
}

if (!string.IsNullOrEmpty(RuntimeIp) && !IPAddress.TryParse(RuntimeIp, out _))
Expand Down

0 comments on commit d919638

Please sign in to comment.