asciidocfx / AsciidocFX

Asciidoc Editor and Toolchain written with JavaFX 21 (Build PDF, Epub, Mobi and HTML books, documents and slides)
http://www.asciidocfx.com/
Apache License 2.0
1.88k stars 295 forks source link

Working Directory change not working if Current working directory's drive not available #514

Closed Ayowel closed 3 years ago

Ayowel commented 3 years ago

Seen on windows 10, AsciidocFX 1.7.3

Opening a working directory on a drive letter that later becomes unavailable makes it impossible to set a new working directory until the drive letter becomes available again.

Example:

Workaround : Edit the value of workingDirectory in ~/.AsciidocFX-*/stored_directories.json to a valid drive path.

The issue appears to be due to the fact that windows' working directory prompt throws an error if it receives an invalid starting path. Validating the path and defaulting to a parent if the path is unavailable or the first value of java.nio.file.FileSystem::getRootDirectories if no parent is available might be a good idea.