@@ -186,30 +186,27 @@ func mod_log(text:String, mod_name:String = "Unknown-Mod", pretty:bool = false)-
186
186
var date_time = Time .get_datetime_dict_from_system ()
187
187
188
188
# Add leading zeroes if needed
189
- var hour = date_time .hour
190
- var mins = date_time .minute
191
- var secs = date_time .second
192
- hour = hour if str (hour ).length () > 1 else str ("0" , hour )
193
- mins = mins if str (mins ).length () > 1 else str ("0" , mins )
194
- secs = secs if str (secs ).length () > 1 else str ("0" , secs )
189
+ var hour := (date_time .hour as String ).pad_zeros (2 )
190
+ var mins := (date_time .minute as String ).pad_zeros (2 )
191
+ var secs := (date_time .second as String ).pad_zeros (2 )
195
192
196
- var date_time_string = str ( date_time .day ,'.' , date_time .month ,'.' , date_time .year ,' - ' , hour ,':' , mins ,':' , secs )
193
+ var date_time_string := " %s . %s . %s - %s : %s : %s " % [ date_time .day , date_time .month , date_time .year , hour , mins , secs ]
197
194
198
195
print (str (date_time_string ,' ' , prefix , text ))
199
196
200
197
var log_file = File .new ()
201
198
202
199
if (! log_file .file_exists (MOD_LOG_PATH )):
203
200
log_file .open (MOD_LOG_PATH , File .WRITE )
204
- log_file .store_string (" \n " + str ( date_time_string , ' ' , ' Created mod.log!') )
201
+ log_file .store_string (' %s Created mod.log!' % date_time_string )
205
202
log_file .close ()
206
203
207
204
var _error = log_file .open (MOD_LOG_PATH , File .READ_WRITE )
208
- if ( _error ) :
205
+ if _error :
209
206
print (_error )
210
207
return
211
208
log_file .seek_end ()
212
- if ( pretty ) :
209
+ if pretty :
213
210
log_file .store_string ("\n " + str (date_time_string ,' ' , prefix , JSON .print (text , " " )))
214
211
else :
215
212
log_file .store_string ("\n " + str (date_time_string ,' ' , prefix , text ))
@@ -529,7 +526,7 @@ func _get_local_folder_dir(subfolder:String = ""):
529
526
var game_install_directory = OS .get_executable_path ().get_base_dir ()
530
527
531
528
if OS .get_name () == "OSX" :
532
- game_install_directory = game_install_directory .get_base_dir ().get_base_dir (). get_base_dir ()
529
+ game_install_directory = game_install_directory .get_base_dir ().get_base_dir ()
533
530
534
531
# Fix for running the game through the Godot editor (as the EXE path would be
535
532
# the editor's own EXE, which won't have any mod ZIPs)
0 commit comments