fix 'tzk convert' failing when outside source directory
I only tested it with '.' as the source for some reason, so missed this.
This commit is contained in:
parent
39df530ec2
commit
1304d8edc2
@ -300,7 +300,7 @@ class ConvertCommand(CliCommand):
|
||||
if not os.path.exists(args.source):
|
||||
fail(f"The source location '{args.source}' does not exist.")
|
||||
if os.path.exists(args.destination) and not args.force:
|
||||
fail(f"The destination location '{args.source}' already exists. "
|
||||
fail(f"The destination location '{args.destination}' already exists. "
|
||||
f"(Use --force to overwrite it.)")
|
||||
|
||||
|
||||
@ -325,14 +325,14 @@ class ConvertCommand(CliCommand):
|
||||
"a tzk_config.py file.")
|
||||
|
||||
with pushd(str(source)):
|
||||
source_wiki_folder = cm().wiki_folder
|
||||
source_wiki_folder = Path.cwd() / cm(cache=[]).wiki_folder
|
||||
|
||||
tw.exec(
|
||||
(
|
||||
("output", str(destination.parent)),
|
||||
("render", "$:/core/save/all", destination.name, "text/plain"),
|
||||
),
|
||||
base_wiki_folder=source_wiki_folder
|
||||
base_wiki_folder=str(source_wiki_folder)
|
||||
)
|
||||
|
||||
# Conversion from file to folder using --savewikifolder.
|
||||
|
@ -44,7 +44,13 @@ def exec(args: Sequence[Sequence[str]], base_wiki_folder: str = None) -> int:
|
||||
during the execution of builders,
|
||||
unless explicitly changed.
|
||||
"""
|
||||
call_args = [_tw_path()]
|
||||
# must pushd into base wiki to find the tiddlywiki node_modules
|
||||
if base_wiki_folder is not None:
|
||||
with pushd(base_wiki_folder):
|
||||
call_args = [_tw_path()]
|
||||
else:
|
||||
call_args = [_tw_path()]
|
||||
|
||||
if base_wiki_folder is not None:
|
||||
call_args.append(base_wiki_folder)
|
||||
for tw_arg in args:
|
||||
|
Loading…
Reference in New Issue
Block a user