Skip to content

Commit e81fab0

Browse files
committed
Fix: Set local file timestamp before broadcastFileWrite
1 parent cb3d696 commit e81fab0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/data/file_manager/file_manager.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,9 @@ class FileManager {
196196
final File file = getFile(filePath);
197197
await _createFileDirectory(filePath);
198198
Future writeFuture = Future.wait([
199-
file.writeAsBytes(toWrite),
199+
file.writeAsBytes(toWrite).then((file) async {
200+
if (lastModified != null) await file.setLastModified(lastModified);
201+
}),
200202
// if we're using a new format, also delete the old file
201203
if (filePath.endsWith(Editor.extension))
202204
getFile(
@@ -209,9 +211,6 @@ class FileManager {
209211
]);
210212

211213
void afterWrite() {
212-
if (lastModified != null) {
213-
file.setLastModified(lastModified);
214-
}
215214
broadcastFileWrite(FileOperationType.write, filePath);
216215
if (alsoUpload) syncer.uploader.enqueueRel(filePath);
217216
if (filePath.endsWith(Editor.extension)) {

0 commit comments

Comments
 (0)