Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete extended properties on file delete #79

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,16 @@ private void EnsurePathExists(string path)
Directory.CreateDirectory(directoryPath);
}
}

public Task DeleteExtendedPropertiesAsync(string storeAbsolutePath, IPrivateFileReference file)
{
var extendedPropertiesPath = this.GetExtendedPropertiesPath(storeAbsolutePath, file);
if (File.Exists(extendedPropertiesPath))
{
File.Delete(extendedPropertiesPath);
}

return Task.FromResult(0);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ public interface IExtendedPropertiesProvider
ValueTask<Internal.FileExtendedProperties> GetExtendedPropertiesAsync(string storeAbsolutePath, IPrivateFileReference file);

Task SaveExtendedPropertiesAsync(string storeAbsolutePath, IPrivateFileReference file, Internal.FileExtendedProperties extendedProperties);

Task DeleteExtendedPropertiesAsync(string storeAbsolutePath, IPrivateFileReference file);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,14 @@ public FileSystemFileReference(

public IFileProperties Properties => this.propertiesLazy.Value;

public Task DeleteAsync()
public async Task DeleteAsync()
{
File.Delete(this.FileSystemPath);
return Task.FromResult(true);

if (extendedPropertiesProvider != null)
{
await extendedPropertiesProvider.DeleteExtendedPropertiesAsync(this.FileSystemPath, this);
}
}

public ValueTask<byte[]> ReadAllBytesAsync()
Expand Down