@@ -250,23 +250,25 @@ func convertTimelines():
250250 var fileName = contents ["metadata" ]["name" ]
251251 % OutputLog .text += "Name: " + fileName + ", " + str (contents ["events" ].size ()) + " timeline events"
252252
253-
254- if not DirAccess .dir_exists_absolute (conversionRootFolder + "/timelines" + folderPath ):
255- var directory = DirAccess .open (conversionRootFolder + "/timelines" )
253+ var dir_timelines = conversionRootFolder + "/timelines"
254+ if not DirAccess .dir_exists_absolute (dir_timelines + folderPath ):
255+ var directory = DirAccess .open (dir_timelines )
256+ if not DirAccess .dir_exists_absolute (dir_timelines ):
257+ DirAccess .make_dir_absolute (dir_timelines )
256258
257259 var progresiveDirectory = ""
258260 for pathItem in folderPath .split ('/' ):
259- directory .open (conversionRootFolder + "/timelines" + progresiveDirectory )
261+ directory .open (dir_timelines + progresiveDirectory )
260262 if pathItem != "" :
261263 progresiveDirectory += "/" + pathItem
262- if ! directory .dir_exists (conversionRootFolder + "/timelines" + progresiveDirectory ):
263- directory .make_dir (conversionRootFolder + "/timelines" + progresiveDirectory )
264+ if ! directory .dir_exists (dir_timelines + progresiveDirectory ):
265+ directory .make_dir (dir_timelines + progresiveDirectory )
264266
265267 # just double check because sometimes its making double slashes at the final filename
266268 if folderPath .right (1 ) == "/" :
267269 folderPath = folderPath .left (- 1 )
268270 # we will save it as an intermediary file first, then on second pass cleanup make it the .dtl
269- var newFilePath = conversionRootFolder + "/timelines" + folderPath + "/" + fileName + ".cnv"
271+ var newFilePath = dir_timelines + folderPath + "/" + fileName + ".cnv"
270272
271273 file = FileAccess .open (newFilePath , FileAccess .WRITE )
272274
@@ -756,17 +758,19 @@ func convertCharacters():
756758
757759
758760
759-
760- if not DirAccess .dir_exists_absolute (conversionRootFolder + "/characters" + folderPath ):
761- var directory = DirAccess .open (conversionRootFolder + "/characters" )
761+ var dir_char = conversionRootFolder + "/characters"
762+ if not DirAccess .dir_exists_absolute (dir_char + folderPath ):
763+ if not DirAccess .dir_exists_absolute (dir_char ):
764+ DirAccess .make_dir_absolute (dir_char )
765+ var directory = DirAccess .open (dir_char )
762766
763767 var progresiveDirectory = ""
764768 for pathItem in folderPath .split ('/' ):
765- directory .open (conversionRootFolder + "/characters" + progresiveDirectory )
769+ directory .open (dir_char + progresiveDirectory )
766770 if pathItem != "" :
767771 progresiveDirectory += "/" + pathItem
768- if ! directory .dir_exists (conversionRootFolder + "/characters" + progresiveDirectory ):
769- directory .make_dir (conversionRootFolder + "/characters" + progresiveDirectory )
772+ if ! directory .dir_exists (dir_char + progresiveDirectory ):
773+ directory .make_dir (dir_char + progresiveDirectory )
770774
771775 # add the prefix if the prefix option is enabled
772776 if prefixCharacters :
@@ -778,7 +782,7 @@ func convertCharacters():
778782 # using the resource constructor for this one
779783
780784 var current_character = DialogicCharacter .new ()
781- current_character .resource_path = conversionRootFolder + "/characters" + folderPath + "/" + fileName + ".dch"
785+ current_character .resource_path = dir_char + folderPath + "/" + fileName + ".dch"
782786 # Everything needs to be in exact order
783787
784788 current_character .color = Color (contents ["color" ].right (6 ))
@@ -922,7 +926,7 @@ func convertVariables():
922926 ProjectSettings .save ()
923927
924928 # rebuild the data in the other tabs, so it doesnt override it
925- find_parent ( 'SettingsEditor' ). refresh ()
929+ refresh ()
926930 % OutputLog .text += str (convertedVariables ) + " variables converted, and saved to project!\r\n "
927931 else :
928932 % OutputLog .text += "[color=yellow]Variable subsystem is not present! Variables were not converted![/color]\r\n "
0 commit comments