/// <summary> /// Sets the specified FileAttributes of the file on the specified path. /// </summary> /// <param name="path">Path to file.</param> /// <param name="fileAttributes">File attributes.</param> public override void SetAttributes(string path, CMS.IO.FileAttributes fileAttributes) { if (!this.Exists(path)) { throw GetFileNotFoundException(path); } IS3ObjectInfo info = S3ObjectFactory.GetInfo(path); if (File.Provider.ObjectExists(info)) { info.SetMetadata(S3ObjectInfoProvider.ATTRIBUTES, ValidationHelper.GetString(ValidationHelper.GetInteger(fileAttributes, 0), string.Empty), false); info.SetMetadata(S3ObjectInfoProvider.LAST_WRITE_TIME, S3ObjectInfoProvider.GetDateTimeString(DateTime.Now)); } else { throw new InvalidOperationException($"Cannot set attributes to file '{path}' because it exists only in application file system. \r\n This exception typically occurs when file system is mapped to Amazon S3 storage after the file or directory\r\n '{path}' was created in the local file system. To fix this issue move given file to Amazon S3 storage."); } }
/// <summary> /// Sets the specified FileAttributes of the file on the specified path. /// </summary> /// <param name="path">Path to file.</param> /// <param name="fileAttributes">File attributes.</param> public override void SetAttributes(string path, CMS.IO.FileAttributes fileAttributes) { var blob = Get(path); blob.SetMetadataAttributeAndSave(BlobMetadataEnum.Attribute, ((int)fileAttributes).ToString()); }