update to new save directory structure

develop
Myk Taylor 2023-01-15 23:13:58 -08:00
parent e7a30a9af8
commit 50cc6d965d
No known key found for this signature in database
8 changed files with 18 additions and 23 deletions

@ -23,7 +23,7 @@ if ! test -f "$df_tardest"; then
fi
done <<URLS
https://www.bay12games.com/dwarves/df_${minor}_${patch}_linux.tar.bz2
https://files.dfhack.org/DF/0.${minor}.${patch}/df_${minor}_${patch}_linux.tar.bz2
https://files.dfhack.org/DF/${minor}.${patch}/df_${minor}_${patch}_linux.tar.bz2
URLS
echo $df_tardest
if ! test -f "$df_tardest"; then
@ -42,11 +42,11 @@ URLS
fi
rm -rf df_linux
mkdir -p df_linux/data/save
mkdir -p df_linux/save
echo Extracting
tar xf "$df_tardest" --strip-components=1 -C df_linux
tar xf "$save_tardest" -C df_linux/data/save
tar xf "$save_tardest" -C df_linux/save
echo Done
ls -l

@ -144,11 +144,10 @@ savegave portability, mod merging, and general organization of init files,
DFHack supports multiple init files both in the main DF directory and
save-specific init files in the save folders.
DFHack looks for init files in three places each time they could be run:
DFHack looks for init files in two places each time they could be run:
#. The :file:`dfhack-config/init` subdirectory in the main DF directory
#. :file:`data/save/{world}/raw`, where ``{world}`` is the current save, and
#. :file:`data/save/{world}/raw/objects`
#. The :file:`dfhack-config/init` subdirectory in the main DF directory and
#. :file:`save/{world}/init`, where ``{world}`` is the current save
For each of those directories, all matching init files will be executed in
alphabetical order.
@ -156,7 +155,7 @@ alphabetical order.
Before running matched init scripts in any of those locations, the
:file:`dfhack-config/init/default.*` file that matches the event will be run to
load DFHack defaults. Only the :file:`dfhack-config/init` directory is checked
for this file, not any :file:`raw` directories. If you want DFHack to load
for this file, not any :file:`save` directories. If you want DFHack to load
without running any of its default configuration commands, edit the
:file:`dfhack-config/init/default.*` files and comment out the commands you see
there.
@ -234,12 +233,11 @@ run. By default, the following folders are searched, in order (relative to the
root DF folder):
#. :file:`dfhack-config/scripts`
#. :file:`data/save/{<region folder>}/raw/scripts` (only if a save is loaded)
#. :file:`raw/scripts`
#. :file:`save/{world}/scripts` (only if a save is loaded)
#. :file:`hack/scripts`
For example, if ``teleport`` is run, these folders are searched in order for
``teleport.lua`` or ``teleport.rb``, and the first matching file is run.
``teleport.lua``, and the first matching file is run.
Script paths can be added by modifying :file:`dfhack-config/script-paths.txt`.
Each line should start with one of these characters:

@ -61,8 +61,7 @@ be:
1. ``own-scripts/``
2. ``dfhack-config/scripts/``
3. ``data/save/*/raw/scripts/``
4. ``raw/scripts/``
3. ``save/*/scripts/``
5. ``hack/scripts/``
The structure of the game

@ -472,9 +472,8 @@ void Core::getScriptPaths(std::vector<std::string> *dest)
if (df::global::world && isWorldLoaded()) {
string save = World::ReadWorldFolder();
if (save.size())
dest->push_back(df_path + "/data/save/" + save + "/raw/scripts");
dest->push_back(df_path + "/save/" + save + "/scripts");
}
dest->push_back(df_path + "/raw/scripts");
dest->push_back(df_path + "/hack/scripts");
for (auto it = script_paths[1].begin(); it != script_paths[1].end(); ++it)
dest->push_back(*it);
@ -2053,7 +2052,7 @@ void Core::handleLoadAndUnloadScripts(color_ostream& out, state_change_event eve
if (!df::global::world)
return;
std::string rawFolder = "data/save/" + (df::global::world->cur_savegame.save_dir) + "/raw/";
std::string rawFolder = "save/" + (df::global::world->cur_savegame.save_dir) + "/init";
auto i = table.find(event);
if ( i != table.end() ) {
@ -2064,7 +2063,6 @@ void Core::handleLoadAndUnloadScripts(color_ostream& out, state_change_event eve
loadScriptFiles(this, out, set, CONFIG_PATH + "init");
loadScriptFiles(this, out, set, rawFolder);
loadScriptFiles(this, out, set, rawFolder + "objects/");
}
for (auto it = state_change_scripts.begin(); it != state_change_scripts.end(); ++it)
@ -2125,7 +2123,7 @@ void Core::onStateChange(color_ostream &out, state_change_event event)
case SC_MAP_UNLOADED:
if (world && world->cur_savegame.save_dir.size())
{
std::string save_dir = "data/save/" + world->cur_savegame.save_dir;
std::string save_dir = "save/" + world->cur_savegame.save_dir;
std::string evtlogpath = save_dir + "/events-dfhack.log";
std::ofstream evtlog;
evtlog.open(evtlogpath, std::ios_base::app); // append

@ -871,7 +871,7 @@ end
function dfhack.getSavePath()
if dfhack.isWorldLoaded() then
return dfhack.getDFPath() .. '/data/save/' .. df.global.world.cur_savegame.save_dir
return dfhack.getDFPath() .. '/save/' .. df.global.world.cur_savegame.save_dir
end
end

@ -299,7 +299,7 @@ IMPLEMENT_VMETHOD_INTERPOSE(autogem_hook, feed);
IMPLEMENT_VMETHOD_INTERPOSE(autogem_hook, render);
bool read_config(color_ostream &out) {
std::string path = "data/save/" + World::ReadWorldFolder() + "/autogems.json";
std::string path = "save/" + World::ReadWorldFolder() + "/autogems.json";
if (!Filesystem::isfile(path)) {
// no need to require the config file to exist
return true;

@ -1171,11 +1171,11 @@ void lightingEngineViewscreen::loadSettings()
std::string rawFolder;
if(df::global::world->cur_savegame.save_dir!="")
{
rawFolder= "data/save/" + (df::global::world->cur_savegame.save_dir) + "/raw/";
rawFolder= "save/" + (df::global::world->cur_savegame.save_dir) + "/";
}
else
{
rawFolder= "raw/";
rawFolder= "dfhack-config/";
}
const std::string settingsfile=rawFolder+"rendermax.lua";

@ -17,7 +17,7 @@ struct title_start_rename_hook : df::viewscreen_titlest {
inline std::string full_save_dir(const std::string &region_name)
{
return std::string("data/save/") + region_name;
return std::string("save/") + region_name;
}
bool do_rename()