core.importer module

Import user content from an old DF or Starter Pack install.

The content to import is defined in PyLNP.json

Two import strategies are currently supported:

copy_add

copy a file or directory contents, non-recursive, no overwriting

text_prepend

prepend imported file content (for logfiles)

These strategies support the ‘low hanging fruit’ of imports. Other content or more advanced strategies have been identified, but are difficult to implement without risking a ‘bad import’ scenario:

init files

Not simply copyable. Sophisticated merging (similar to graphics upgrades) may lead to bad config when using settings from an older version of DF. Will not be supported.

keybinds

Could be imported by minimising interface.txt (and LNP/Keybinds/*) (see core/keybinds.py), and copying if a duplicate set is not yet available. Planned for future update.

world_gen, embark_profiles

Importing world gen and embark profiles may be supported eventually. No obvious downsides beyond tricky implementation.

other

Custom settings importer - eg which graphics pack, are aquifers disabled, other PyLNP settings… May be added later but no plans.

core.importer.do_imports(from_df_dir)[source]

Import content (defined in PyLNP.json) from the given previous df_dir, and associated LNP install if any.

core.importer.strat_copy_add(src, dest)[source]

Copy a file or directory contents from src to dest, without overwriting. If a single file, an existing file may be overwritten if it only contains whitespace. For directory contents, only the top level is ‘filled in’.

core.importer.strat_fallback(strat)[source]

Log error if an unknown strategy is attempted.

core.importer.strat_text_prepend(src, dest)[source]

Prepend the src textfile to the dest textfile, creating it if needed.