Achilles.Acme.Storage.Azure.AzureCloudStorageProvider.FileExists C# (CSharp) Method

FileExists() public method

public FileExists ( string path ) : bool
path string
return bool
        public override bool FileExists( string path )
        {
            if ( path == null )
                return false;

            // TJT: Review needed
            if ( path.EndsWith( @"/" ) )
            {
                Trace.WriteLine( string.Format( "Invalid parameter {0} for method FileExists", path ), "Error" );
                return false;
            }

            // remove the first '/' char
            string fileBlobPath = path.ToAzurePath();

            try
            {
                CloudBlockBlob blob = _container.GetBlockBlobReference( fileBlobPath );
                blob.FetchAttributes();
            }
            catch ( StorageException )
            {
                return false;
            }

            return true;
        }