Merge pull request #2252 from myk002/myk_history

Move .history files to dfhack-config
develop
Myk 2022-08-02 22:46:50 -07:00 committed by GitHub
commit cda2edab6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 8 deletions

@ -42,6 +42,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## Misc Improvements
- Init scripts: ``dfhack.init`` and other init scripts have moved to ``dfhack-config/init/``. If you have customized your ``dfhack.init`` file and want to keep your changes, please move the part that you have customized to the new location at ``dfhack-config/init/dfhack.init``. If you do not have changes that you want to keep, do not copy anything, and the new defaults will be used automatically.
- History files: ``dfhack.history``, ``tiletypes.history``, ``lua.history``, and ``liquids.history`` have moved to the ``dfhack-config`` directory. If you'd like to keep the contents of your current history files, please move them to ``dfhack-config``.
- `keybinding`: support backquote (\`) as a hotkey
- `manipulator`: add a library of useful default professions
- `manipulator`: move professions configuration from ``professions/`` to ``dfhack-config/professions/`` to keep it together with other dfhack configuration. If you have saved professions that you would like to keep, please manually move them to the new folder.

@ -1469,12 +1469,14 @@ void fInitthread(void * iodata)
// A thread function... for the interactive console.
void fIOthread(void * iodata)
{
static const char * HISTORY_FILE = "dfhack-config/dfhack.history";
IODATA * iod = ((IODATA*) iodata);
Core * core = iod->core;
PluginManager * plug_mgr = ((IODATA*) iodata)->plug_mgr;
CommandHistory main_history;
main_history.load("dfhack.history");
main_history.load(HISTORY_FILE);
Console & con = core->getConsole();
if (plug_mgr == 0)
@ -1515,7 +1517,7 @@ void fIOthread(void * iodata)
{
// a proper, non-empty command was entered
main_history.add(command);
main_history.save("dfhack.history");
main_history.save(HISTORY_FILE);
}
auto rv = core->runCommand(con, command);

@ -1145,7 +1145,7 @@ bool DFHack::Lua::InterpreterLoop(color_ostream &out, lua_State *state,
return false;
if (!hfile)
hfile = "lua.history";
hfile = "dfhack-config/lua.history";
if (!prompt)
prompt = "lua";

@ -55,6 +55,7 @@ using namespace df::enums;
DFHACK_PLUGIN("liquids");
REQUIRE_GLOBAL(world);
static const char * HISTORY_FILE = "dfhack-config/liquids.history";
CommandHistory liquids_hist;
command_result df_liquids (color_ostream &out, vector <string> & parameters);
@ -62,7 +63,7 @@ command_result df_liquids_here (color_ostream &out, vector <string> & parameters
DFhackCExport command_result plugin_init ( color_ostream &out, std::vector <PluginCommand> &commands)
{
liquids_hist.load("liquids.history");
liquids_hist.load(HISTORY_FILE);
commands.push_back(PluginCommand(
"liquids", "Place magma, water or obsidian.",
df_liquids, true,
@ -80,7 +81,7 @@ DFhackCExport command_result plugin_init ( color_ostream &out, std::vector <Plug
DFhackCExport command_result plugin_shutdown ( color_ostream &out )
{
liquids_hist.save("liquids.history");
liquids_hist.save(HISTORY_FILE);
return CR_OK;
}

@ -74,7 +74,7 @@ static const struct_field_info tiletypes_options_fields[] = {
};
struct_identity tiletypes_options::_identity(sizeof(tiletypes_options), &df::allocator_fn<tiletypes_options>, NULL, "tiletypes_options", NULL, tiletypes_options_fields);
static const char * HISTORY_FILE = "dfhack-config/tiletypes.history";
CommandHistory tiletypes_hist;
command_result df_tiletypes (color_ostream &out, vector <string> & parameters);
@ -84,7 +84,7 @@ command_result df_tiletypes_here_point (color_ostream &out, vector <string> & pa
DFhackCExport command_result plugin_init ( color_ostream &out, std::vector <PluginCommand> &commands)
{
tiletypes_hist.load("tiletypes.history");
tiletypes_hist.load(HISTORY_FILE);
commands.push_back(PluginCommand("tiletypes", "Paint map tiles freely, similar to liquids.", df_tiletypes, true));
commands.push_back(PluginCommand("tiletypes-command", "Run tiletypes commands (seperated by ' ; ')", df_tiletypes_command));
commands.push_back(PluginCommand("tiletypes-here", "Repeat tiletypes command at cursor (with brush)", df_tiletypes_here));
@ -94,7 +94,7 @@ DFhackCExport command_result plugin_init ( color_ostream &out, std::vector <Plug
DFhackCExport command_result plugin_shutdown ( color_ostream &out )
{
tiletypes_hist.save("tiletypes.history");
tiletypes_hist.save(HISTORY_FILE);
return CR_OK;
}