Blog.Common.Utils.Helpers.FileHelper.CreateFile C# (CSharp) Method

CreateFile() public method

public CreateFile ( string path ) : bool
path string
return bool
        public bool CreateFile(string path)
        {
            try
            {
                if (!Directory.Exists(path))
                {
                    var tPath = Path.GetDirectoryName(path);
                    if (tPath != null) Directory.CreateDirectory(tPath);
                }

                File.Create(path).Close();
                return true;
            }
            catch (Exception ex)
            {
                throw new BlogException(ex.Message, ex.InnerException);
            }
        }