deleteFile static method
- String relativePath
Delete a file from the POD.
relativePath - Path relative to the data directory.
Returns true if deletion was successful.
Implementation
static Future<bool> deleteFile(String relativePath) async {
if (!await PodAuth.isLoggedIn()) {
debugPrint('PodFileSystem.deleteFile() - not logged in');
return false;
}
try {
final url = await PodPath.getFileUrl(relativePath);
final response = await PodHttp.delete(url);
if (response.isSuccess || response.isNotFound) {
debugPrint('PodFileSystem.deleteFile() - success: $relativePath');
return true;
} else {
debugPrint(
'PodFileSystem.deleteFile() - error ${response.statusCode}: ${response.body}',
);
return false;
}
} catch (e) {
debugPrint('PodFileSystem.deleteFile() - exception: $e');
return false;
}
}