diff --git a/tzk/__main__.py b/tzk/__main__.py index 72f284e..1ac3e7a 100644 --- a/tzk/__main__.py +++ b/tzk/__main__.py @@ -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. diff --git a/tzk/tw.py b/tzk/tw.py index 9d3b840..2009c41 100644 --- a/tzk/tw.py +++ b/tzk/tw.py @@ -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: