public BookInfo(string folderPath, bool isEditable)
{
FolderPath = folderPath;
//NB: This was coded in an unfortunate way such that touching almost any property causes a new metadata to be quietly created.
//So It's vital that we not touch properties that could create a blank metadata, before attempting to load the existing one.
_metadata = BookMetaData.FromFolder(FolderPath);
if (_metadata == null)
{
// Look for old tags files not yet migrated
var oldTagsPath = Path.Combine(folderPath, "tags.txt");
if (RobustFile.Exists(oldTagsPath))
{
Book.ConvertTagsToMetaData(oldTagsPath, this);
}
// otherwise leave it null, first attempt to use will create a default one
}
IsEditable = isEditable;
FixDefaultsIfAppropriate();
}