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

[WIP] Add support for dynamic detection of the working directory #509

Closed Ayowel closed 3 years ago

Ayowel commented 3 years ago

This PR aim is to :

[...] [Add] support for the detection of a .asciidocfx file in the folder where the workdir should be set so that, like git with .git we can search the parent directories and detect where the context should be set. This would make working on projects with multiple file includes in subfolders - or on multiple projects - more manageable as the right working directory could be set each time we open asciidocfx with a project's file no matter its location in the project's tree.

DO NOT MERGE as-is as a rebase and updates will be required if you merge PR#508. I opened this PR so that this behavior could be discussed before further implementation.

As of now, the working directory is calculated for the first file received as input only, which seems to me like a legitimate assumption as it covers the most common use-case and avoids the complexity associated with a potential conflict resolution issue. A relevant change might be to stop at the first file where a flag file is found instead of testing only for the first file.

A later development of this feature could be to systematically check for the flag file when changing tab, so that it becomes possible to work on more than one "project" at a time without restarting asciidocfx.

Ayowel commented 3 years ago

Forgot to close after fix on master, sorry