Skip to content

Commit e749a2d

Browse files
committed
Add DataFileSystem.DeleteDataFile & DynamicConfigFile.Delete methods
1 parent e0e373f commit e749a2d

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

src/Configuration/DynamicConfigFile.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,19 @@ public bool Exists(string filename = null)
119119
return File.Exists(filename);
120120
}
121121

122+
/// <summary>
123+
/// Removes specified file
124+
/// </summary>
125+
/// <param name="filename"></param>
126+
public void Delete(string filename = null)
127+
{
128+
filename = CheckPath(filename ?? Filename);
129+
if (Exists(filename))
130+
{
131+
File.Delete(filename);
132+
}
133+
}
134+
122135
/// <summary>
123136
/// Check if file path is in chroot directory
124137
/// </summary>

src/DataFileSystem.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ public T ReadObject<T>(string name)
110110

111111
public void WriteObject<T>(string name, T Object, bool sync = false) => GetFile(name).WriteObject(Object, sync);
112112

113+
/// <summary>
114+
/// Removes the specified datafile
115+
/// </summary>
116+
/// <param name="name"></param>
117+
public void DeleteDataFile(string name) => GetFile(name).Delete();
118+
113119
/// <summary>
114120
/// Read data files in a batch and send callback
115121
/// </summary>

0 commit comments

Comments
 (0)