File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717 "to_import" : [
1818 [" text_prepend" , " <df>/gamelog.txt" ],
1919 [" text_prepend" , " <df>/ss_fix.log" ],
20- [" text_prepend" , " <df >/dfhack.history" ],
20+ [" text_prepend" , " <dfhack_config >/dfhack.history" ],
2121 [" copy_add" , " <df>/data/save" ],
2222 [" copy_add" , " <df>/soundsense" ]
2323 ],
Original file line number Diff line number Diff line change @@ -49,6 +49,11 @@ def set_df_folder(path):
4949 paths .register ('save' , paths .get ('data' ), 'save' , allow_create = False )
5050 paths .register ('extras' , paths .get ('lnp' ), 'Extras' )
5151 paths .register ('defaults' , paths .get ('lnp' ), 'Defaults' )
52+ if os .path .exists (paths .get ('df' , 'hack' , 'init' )):
53+ paths .register (
54+ 'dfhack_config' , paths .get ('df' , 'dfhack-config' , 'init' ))
55+ else :
56+ paths .register ('dfhack_config' , paths .get ('df' ), allow_create = False )
5257 lnp .df_info = DFInstall (paths .get ('df' ))
5358 lnp .settings = lnp .df_info .settings
5459 if lnp .args .release_prep or lnp .args .raw_lint :
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ def read_hacks():
2323 hacklines = []
2424 for init_file in ('dfhack' , 'onLoad' , 'onMapLoad' ):
2525 try :
26- with open (paths .get ('df ' , init_file + '_PyLNP.init' ),
26+ with open (paths .get ('dfhack_config ' , init_file + '_PyLNP.init' ),
2727 encoding = 'latin1' ) as f :
2828 hacklines .extend (l .strip () for l in f .readlines ())
2929 except IOError :
@@ -108,7 +108,7 @@ def toggle_hack(name):
108108 is_enabled = True
109109 hacks [name ] = hack
110110 # Write back to the file
111- fname = paths .get ('df ' , init_file + '_PyLNP.init' )
111+ fname = paths .get ('dfhack_config ' , init_file + '_PyLNP.init' )
112112 log .i ('Rebuilding {} with the enabled hacks' .format (fname ))
113113 lines = ['# {}\n # {}\n {}\n \n ' .format (
114114 k , h ['tooltip' ].replace ('\n ' , '\n #' ), h ['command' ])
Original file line number Diff line number Diff line change @@ -122,11 +122,20 @@ def do_imports(from_df_dir):
122122 for st , src , dest in raw_config :
123123 if '<df>' in src :
124124 newsrc = src .replace ('<df>' , from_df_dir )
125+ elif '<dfhack_config>' in src :
126+ if os .path .exists (os .path .join (from_df_dir , 'hack' , 'init' )):
127+ newsrc = src .replace ('<dfhack_config>' , os .path .join (
128+ from_df_dir , 'dfhack-config' , 'init' ))
129+ else :
130+ newsrc = src .replace ('<dfhack_config>' , from_df_dir )
125131 else :
126132 newsrc = os .path .join (from_df_dir , '../' , src )
127133 newsrc = os .path .abspath (os .path .normpath (newsrc ))
128134 if '<df>' in dest :
129135 newdest = dest .replace ('<df>' , paths .get ('df' ))
136+ elif '<dfhack_config>' in src :
137+ newdest = dest .replace (
138+ '<dfhack_config>' , paths .get ('dfhack_config' ))
130139 else :
131140 newdest = paths .get ('root' , dest )
132141 newdest = os .path .abspath (os .path .normpath (newdest ))
Original file line number Diff line number Diff line change @@ -169,7 +169,7 @@ def initialize_program(self):
169169 "to_import" : [
170170 ['text_prepend' , '<df>/gamelog.txt' ],
171171 ['text_prepend' , '<df>/ss_fix.log' ],
172- ['text_prepend' , '<df >/dfhack.history' ],
172+ ['text_prepend' , '<dfhack_config >/dfhack.history' ],
173173 ['copy_add' , '<df>/data/save' ],
174174 ['copy_add' , '<df>/soundsense' ,
175175 'LNP/Utilities/Soundsense/packs' ],
You can’t perform that action at this time.
0 commit comments