kevboh / longform

A plugin for Obsidian that helps you write and edit novels, screenplays, and other long projects.
Other
610 stars 30 forks source link

Bug: missing scene folder when creating draft causes plugin to break until the folder exists #157

Closed nathonius closed 9 months ago

nathonius commented 1 year ago

Versions Longform version: 2.0.3 Obsidian version: 1.2.3 OS: macOS Theme: Sanctum Other plugins that you think might be relevant here:

Describe the bug Creating a new draft with a custom scene folder set while not copying scenes produces an error state until the scene folder is created and Obsidian is restarted. Similarly, trying to copy the scenes will fail when a custom scene folder is set.

To Reproduce Steps to reproduce the behavior:

  1. Have a multi-scene project
  2. Create a folder to house scenes, eg. Scenes
  3. Configure the project to use the custom scene folder Scenes
  4. Create a new draft of the project without copying scenes

Note that project pane will be empty of content, scenes tab is missing. Console error clearly states that this is due to the custom scene folder not being present:

Uncaught (in promise) Error: ENOENT: no such file or directory, scandir '/Path/to/vault/ProjectV2/Scenes'

Expected behavior

I believe you could also produce this by manually setting the scene folder in the YAML instead of creating a draft, but that seems like it's out of the scope of the plugin to handle. Longform also fails to create the draft if copying files, as it cannot copy the files to the missing scene folder.

I think the best behavior would be for the plugin to always create the custom scene folder, if it is set; this would fix the issue when both copying and not copying scenes.