File is deleted on write to ensure it does not continuously grow
This commit is contained in:
parent
86ae7ad4aa
commit
0a5d99cd6f
3 changed files with 7 additions and 1 deletions
|
@ -7,6 +7,10 @@ import 'impl/CompoundTag.dart';
|
|||
class SnbtIo {
|
||||
static void write(String file, CompoundTag tag) {
|
||||
File handle = File(file);
|
||||
|
||||
if (handle.existsSync())
|
||||
handle.deleteSync(); // Ensure we flush the file to 0 bytes
|
||||
|
||||
StringBuilder builder = StringBuilder();
|
||||
Tag.writeStringifiedNamedTag(tag, builder, 0);
|
||||
handle.writeAsString(builder.toString());
|
||||
|
|
|
@ -210,6 +210,8 @@ class ByteLayer {
|
|||
|
||||
Future<void> writeToFile(String filePath) async {
|
||||
final file = File(filePath);
|
||||
if (file.existsSync())
|
||||
file.deleteSync(); // Ensure we flush the file to 0 bytes
|
||||
await file.writeAsBytes(bytes);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: libac_dart
|
||||
description: "Aria's Creations code library"
|
||||
version: 1.0.21
|
||||
version: 1.0.22
|
||||
homepage: "https://zontreck.com"
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue