Fix bug with long folder templates

This commit is contained in:
Michael Bucari-Tovo 2023-01-08 10:01:30 -07:00
parent 452ceef285
commit fca946bf15
2 changed files with 15 additions and 3 deletions

View File

@ -103,7 +103,7 @@ namespace LibationAvalonia.Dialogs
get => _userTemplateText;
set
{
_userTemplateText = value;
this.RaiseAndSetIfChanged(ref _userTemplateText, value);
templateTb_TextChanged();
}
}
@ -165,7 +165,13 @@ namespace LibationAvalonia.Dialogs
var books = config.Books;
var folder = Templates.Folder.GetPortionFilename(
libraryBookDto,
isFolder ? workingTemplateText : config.FolderTemplate);
//Path must be rooted for windows to allow long file paths. This is
//only necessary for folder templates because they may contain several
//subdirectories. Without rooting, we won't be allowed to create a
//relative path longer than MAX_PATH
Path.Combine(books, isFolder ? workingTemplateText : config.FolderTemplate));
folder = Path.GetRelativePath(books, folder);
var file
= Template == Templates.ChapterFile

View File

@ -98,11 +98,17 @@ namespace LibationWinForms.Dialogs
};
var books = config.Books;
var folder = Templates.Folder.GetPortionFilename(
libraryBookDto,
isFolder ? workingTemplateText : config.FolderTemplate);
//Path must be rooted for windows to allow long file paths. This is
//only necessary for folder templates because they may contain several
//subdirectories. Without rooting, we won't be allowed to create a
//relative path longer than MAX_PATH
Path.Combine(books, isFolder ? workingTemplateText : config.FolderTemplate));
folder = Path.GetRelativePath(books, folder);
var file
= template == Templates.ChapterFile