public static string ValidateFilePath()

in Configurator/Base/Classes/Utilities.cs [1583:1637]


    public static string ValidateFilePath(string filePath)
    {
      string errorMessage = null;
      try
      {
        var directoryPath = Path.GetDirectoryName(filePath);
        if (!string.IsNullOrEmpty(directoryPath)
            && !Path.IsPathRooted(filePath))
        {
          errorMessage = Resources.PathNotAbsoluteError;
        }

        if (string.IsNullOrEmpty(errorMessage))
        {
          var absolutePath = Path.GetFullPath(filePath);
          if (!string.IsNullOrEmpty(absolutePath))
          {
            var fileName = Path.GetFileName(absolutePath);
            if (string.IsNullOrEmpty(fileName))
            {
              errorMessage = Resources.PathContainsNoFileError;
            }

            if (string.IsNullOrEmpty(errorMessage)
                && !string.IsNullOrEmpty(directoryPath)
                && !Directory.Exists(directoryPath))
            {
              errorMessage = Resources.PathNonExistentDirectoryError;
            }
          }
        }
      }
      catch (ArgumentNullException)
      {
        errorMessage = Resources.PathIsNullError;
      }
      catch (ArgumentException)
      {
        errorMessage = Resources.PathContainsInvalidCharactersError;
      }
      catch (PathTooLongException)
      {
        errorMessage = Resources.PathTooLongError;
      }
      catch (NotSupportedException)
      {
        errorMessage = Resources.PathContainsColonError;
      }
      catch (Exception)
      {
        errorMessage = Resources.PathUnknownError;
      }

      return errorMessage;
    }