@@ -131,18 +131,18 @@ void OnGUI()
131131 }
132132 else
133133 {
134- outputDirectory = Path . Combine ( CommunFonctions . GoUpNDirs ( CustomfbxPath , 2 ) , "patcher " , "data " , "DiffFiles" ) ;
134+ outputDirectory = Path . Combine ( CommunFonctions . GoUpNDirs ( CustomfbxPath , 2 ) , "Patcher " , "Data " , "DiffFiles" ) ;
135135 if ( NameOverwriteTickBox )
136136 {
137137 if ( ! string . IsNullOrEmpty ( DistributionNameOverwriteText ) )
138138 {
139- patcherFolder = Path . Combine ( CommunFonctions . GoUpNDirs ( CustomfbxPath , 3 ) , DistributionNameOverwriteText , "patcher " ) ;
139+ patcherFolder = Path . Combine ( CommunFonctions . GoUpNDirs ( CustomfbxPath , 3 ) , DistributionNameOverwriteText , "Patcher " ) ;
140140 PatcherScriptDestDir = Path . Combine ( CommunFonctions . GoUpNDirs ( outputDirectory , 2 ) , "Editor" , DistributionNameOverwriteText . Replace ( " " , "_" ) + "_Patcher.cs" ) ;
141141 }
142142 }
143143 else
144144 {
145- patcherFolder = Path . Combine ( CommunFonctions . GoUpNDirs ( CustomfbxPath , 2 ) , "patcher " ) ;
145+ patcherFolder = Path . Combine ( CommunFonctions . GoUpNDirs ( CustomfbxPath , 2 ) , "Patcher " ) ;
146146 PatcherScriptDestDir = Path . Combine ( CommunFonctions . GoUpNDirs ( outputDirectory , 2 ) , "Editor" , Path . GetFileNameWithoutExtension ( CustomfbxPath ) . Replace ( " " , "_" ) + "_Patcher.cs" ) ;
147147 }
148148 }
@@ -174,9 +174,9 @@ void OnGUI()
174174 UserEditorWindowName = EditorGUILayout . TextField ( new GUIContent ( "Your Name: " , "Will be used to organize your patchers in the menu bar" ) , UserEditorWindowName ) ;
175175 if ( NameOverwriteTickBox )
176176 {
177- if ( ! string . IsNullOrEmpty ( DistributionNameOverwriteText ) ) EditorWindowPath = "Tools/" + UserEditorWindowName + "/" + DistributionNameOverwriteText . Replace ( " " , "_" ) + "_Patcher " ;
177+ if ( ! string . IsNullOrEmpty ( DistributionNameOverwriteText ) ) EditorWindowPath = "Tools/" + UserEditorWindowName + "/" + DistributionNameOverwriteText + " Patcher " ;
178178 }
179- else EditorWindowPath = "Tools/" + UserEditorWindowName + "/" + Path . GetFileNameWithoutExtension ( OGfbxPath ) + "Patcher" ;
179+ else EditorWindowPath = "Tools/" + UserEditorWindowName + "/" + Path . GetFileNameWithoutExtension ( OGfbxPath ) + " Patcher" ;
180180 if ( string . IsNullOrEmpty ( UserEditorWindowName ) )
181181 {
182182
@@ -395,8 +395,10 @@ void OnGUI()
395395
396396 private void BuildPatcher ( )
397397 {
398-
399- Directory . CreateDirectory ( outputDirectory ) ;
398+ //Check if output directory already exists
399+ if ( ! Directory . Exists ( outputDirectory ) ) {
400+ Directory . CreateDirectory ( outputDirectory ) ;
401+ }
400402
401403 if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ) {
402404 hdiffz = Path . Combine ( Environment . CurrentDirectory , "Assets" , "Hash's_Things" , "EditDistributor" , "hdiff" , "hdiffz" , "Windows" , "hdiffz.exe" ) ;
@@ -444,9 +446,12 @@ private void BuildPatcher()
444446 }
445447 else PatcherScriptDestDir = Path . Combine ( CommunFonctions . GoUpNDirs ( outputDirectory , 2 ) , "Editor" , Path . GetFileNameWithoutExtension ( CustomfbxPath ) . Replace ( " " , "_" ) + "_Patcher.cs" ) ;
446448
449+ //Check if patcher script destination director already exists
450+ if ( ! Directory . Exists ( CommunFonctions . GoUpNDirs ( PatcherScriptDestDir , 1 ) ) ) {
451+ Directory . CreateDirectory ( CommunFonctions . GoUpNDirs ( PatcherScriptDestDir , 1 ) ) ;
452+ CommunFonctions . CopyFolder ( hdiffzFolder , hpatchzDestDir ) ;
453+ }
447454
448- Directory . CreateDirectory ( CommunFonctions . GoUpNDirs ( PatcherScriptDestDir , 1 ) ) ;
449- CommunFonctions . CopyFolder ( hdiffzFolder , hpatchzDestDir ) ;
450455 CommunFonctions . CheckAndCopyFileIfExists ( PatcherTemplateScript , PatcherScriptDestDir ) ;
451456
452457
@@ -459,7 +464,7 @@ private void BuildPatcher()
459464 UnityEngine . Debug . Log ( EditorWindowPath ) ;
460465 CommunFonctions . ReplaceStringsInFile ( PatcherScriptDestDir , originalStrings , remplacementStrings ) ;
461466
462- UnityEngine . Debug . Log ( "patcher created yippie :D" ) ;
467+ UnityEngine . Debug . Log ( "Patcher created yippie :D" ) ;
463468 AssetDatabase . Refresh ( ) ;
464469 }
465470
@@ -469,7 +474,7 @@ private void BuildPatcher()
469474
470475 private void AddDebugInfo ( )
471476 {
472- string outputDirectory = Path . Combine ( CommunFonctions . GoUpNDirs ( CustomfbxPath , 2 ) , "patcher " , "data " , "DiffFiles" ) ;
477+ string outputDirectory = Path . Combine ( CommunFonctions . GoUpNDirs ( CustomfbxPath , 2 ) , "Patcher " , "Data " , "DiffFiles" ) ;
473478 //some debug things that helped tracing back issues
474479 GUILayout . Label ( "outputDirectory: " + outputDirectory ) ;
475480 GUILayout . Label ( "hdiff: " + Path . Combine ( Environment . CurrentDirectory , "Assets" , "Hash's_Things" , "EditDistributor" , "pythonscripts" , "hdiff" , "hdiffz.exe" ) ) ;
0 commit comments