@@ -138,13 +138,33 @@ def find_spinescene_files():
138
138
139
139
print (f"Lua table with animations has been written to { lua_output_file_path } " )
140
140
141
+ import configparser
142
+ import os
143
+
144
+ class CustomConfigParser (configparser .ConfigParser ):
145
+ """Custom ConfigParser to add spaces around '=' when writing."""
146
+ def write (self , fp , space_around_delimiters = True ):
147
+ """Write an .ini-format representation of the configuration state."""
148
+ if space_around_delimiters :
149
+ delimiter = " = "
150
+ else :
151
+ delimiter = "="
152
+
153
+ for section in self ._sections :
154
+ fp .write (f"[{ section } ]\n " )
155
+ for key , value in self ._sections [section ].items ():
156
+ if value is not None :
157
+ value = str (value ).replace ("\n " , "\n \t " )
158
+ fp .write (f"{ key } { delimiter } { value } \n " )
159
+ fp .write ("\n " )
160
+
141
161
def modify_game_project (file_path ):
142
162
if not os .path .isfile (file_path ):
143
163
print (f"Error: The file '{ file_path } ' does not exist." )
144
164
return
145
165
146
166
# Load the existing game.project file
147
- config = configparser . ConfigParser (allow_no_value = True , delimiters = ('=' ))
167
+ config = CustomConfigParser (allow_no_value = True , delimiters = ('=' ))
148
168
config .optionxform = str # Preserve case sensitivity
149
169
config .read (file_path )
150
170
@@ -172,9 +192,9 @@ def modify_game_project(file_path):
172
192
config ["spine" ] = {}
173
193
config ["spine" ]["max_count" ] = "8192"
174
194
175
- # Save the updated file
195
+ # Save the updated file with spaces around the '='
176
196
with open (file_path , "w" ) as configfile :
177
- config .write (configfile , space_around_delimiters = False )
197
+ config .write (configfile , space_around_delimiters = True )
178
198
179
199
def delete_project_files ():
180
200
# Define file patterns to delete and track deleted file counts
0 commit comments