mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 09:47:35 +08:00
NotesFolder: Add more debug information when loading
This will help better diagnose why files don't sometimes show up
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:fimber/fimber.dart';
|
||||||
import 'package:path/path.dart' as p;
|
import 'package:path/path.dart' as p;
|
||||||
import 'package:path/path.dart';
|
import 'package:path/path.dart';
|
||||||
|
|
||||||
@ -161,6 +162,7 @@ class NotesFolder
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fsEntity is Directory) {
|
if (fsEntity is Directory) {
|
||||||
|
Fimber.d("Found directory ${fsEntity.path}");
|
||||||
var subFolder = NotesFolder(this, fsEntity.path);
|
var subFolder = NotesFolder(this, fsEntity.path);
|
||||||
if (subFolder.name.startsWith('.')) {
|
if (subFolder.name.startsWith('.')) {
|
||||||
continue;
|
continue;
|
||||||
@ -177,8 +179,10 @@ class NotesFolder
|
|||||||
|
|
||||||
var note = Note(this, fsEntity.path);
|
var note = Note(this, fsEntity.path);
|
||||||
if (!note.filePath.toLowerCase().endsWith('.md')) {
|
if (!note.filePath.toLowerCase().endsWith('.md')) {
|
||||||
|
Fimber.d("Ignoring file ${fsEntity.path}");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Fimber.d("Found file ${fsEntity.path}");
|
||||||
note.addListener(_entityChanged);
|
note.addListener(_entityChanged);
|
||||||
|
|
||||||
_notes.add(note);
|
_notes.add(note);
|
||||||
@ -198,12 +202,14 @@ class NotesFolder
|
|||||||
_entityMap.remove(path);
|
_entityMap.remove(path);
|
||||||
|
|
||||||
if (e is Note) {
|
if (e is Note) {
|
||||||
|
Fimber.d("File $path was no longer found");
|
||||||
var i = _notes.indexWhere((n) => n.filePath == path);
|
var i = _notes.indexWhere((n) => n.filePath == path);
|
||||||
assert(i != -1);
|
assert(i != -1);
|
||||||
var note = _notes[i];
|
var note = _notes[i];
|
||||||
_notes.removeAt(i);
|
_notes.removeAt(i);
|
||||||
notifyNoteRemoved(i, note);
|
notifyNoteRemoved(i, note);
|
||||||
} else {
|
} else {
|
||||||
|
Fimber.d("Folder $path was no longer found");
|
||||||
var i = _folders.indexWhere((f) => f.folderPath == path);
|
var i = _folders.indexWhere((f) => f.folderPath == path);
|
||||||
assert(i != -1);
|
assert(i != -1);
|
||||||
var folder = _folders[i];
|
var folder = _folders[i];
|
||||||
|
Reference in New Issue
Block a user