Skip to content

Commit f71700a

Browse files
committed
Added Linux & MacOS support
added proper Linux and MacOS support
1 parent 3b2bcd0 commit f71700a

File tree

2,467 files changed

+7786
-6282
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,467 files changed

+7786
-6282
lines changed

DemoProject/Assets/Hash's_Things/EditDistributor/Editor/CommunFonctions.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,31 @@ public static void LaunchProgramWithArguments(string programPath, string argumen
369369
}
370370
}
371371

372+
373+
374+
public static void CopyFolder(string sourceDir, string destDir)
375+
{
376+
if (!Directory.Exists(destDir))
377+
{
378+
Directory.CreateDirectory(destDir);
379+
}
380+
381+
// Copy files
382+
foreach (string file in Directory.GetFiles(sourceDir))
383+
{
384+
string destFile = Path.Combine(destDir, Path.GetFileName(file));
385+
CheckAndCopyFileIfExists(file, destFile);
386+
}
387+
388+
// Recursively copy subdirectories
389+
foreach (string subDir in Directory.GetDirectories(sourceDir))
390+
{
391+
string destSubDir = Path.Combine(destDir, Path.GetFileName(subDir));
392+
CopyFolder(subDir, destSubDir);
393+
}
394+
}
372395
}
373396

397+
398+
374399
}

DemoProject/Assets/Hash's_Things/EditDistributor/Editor/EditDistributorBuilder.cs

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Text.RegularExpressions;
66
using System.Diagnostics;
77
using System.Collections;
8+
using System.Runtime.InteropServices;
89

910
namespace EditDistributor {
1011

@@ -390,29 +391,50 @@ private void BuildPatcher()
390391

391392
Directory.CreateDirectory(outputDirectory);
392393

393-
hdiffz = Path.Combine(Environment.CurrentDirectory, "Assets", "Hash's_Things", "EditDistributor", "hdiff", "hdiffz.exe");
394-
hpatchz = Path.Combine(Environment.CurrentDirectory, "Assets", "Hash's_Things", "EditDistributor", "hdiff", "hpatchz.exe");
395-
string hpatchzlicence = Path.Combine(Environment.CurrentDirectory, "Assets", "Hash's_Things", "EditDistributor", "hdiff", "License.txt");
394+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)){
395+
hdiffz = Path.Combine(Environment.CurrentDirectory, "Assets", "Hash's_Things", "EditDistributor", "hdiff", "hdiffz", "Windows", "hdiffz.exe");
396+
hpatchz = Path.Combine(Environment.CurrentDirectory, "Assets", "Hash's_Things", "EditDistributor", "hdiff", "hpatchz", "Windows", "hpatchz.exe");
397+
}
398+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) {
399+
hdiffz = Path.Combine(Environment.CurrentDirectory, "Assets", "Hash's_Things", "EditDistributor", "hdiff", "hdiffz", "Linux", "hdiffz");
400+
hpatchz = Path.Combine(Environment.CurrentDirectory, "Assets", "Hash's_Things", "EditDistributor", "hdiff", "hpatchz", "Linux", "hpatchz");
401+
}
402+
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) {
403+
hdiffz = Path.Combine(Environment.CurrentDirectory, "Assets", "Hash's_Things", "EditDistributor", "hdiff", "hdiffz", "Mac", "hdiffz");
404+
hpatchz = Path.Combine(Environment.CurrentDirectory, "Assets", "Hash's_Things", "EditDistributor", "hdiff", "hpatchz", "Mac", "hpatchz");
405+
}
406+
string hdiffzFolder = Path.Combine(Environment.CurrentDirectory, "Assets", "Hash's_Things", "EditDistributor", "hdiff", "hpatchz");
396407
FBXDiffFile = Path.Combine(outputDirectory, Path.GetFileNameWithoutExtension(OGfbxPath).Replace(" ", "_") + ".hdiff");
397408
MetaDiffFile = Path.Combine(outputDirectory, Path.GetFileNameWithoutExtension(OGfbxPath).Replace(" ", "_") + "Meta.hdiff");
398409

399410
if (File.Exists(hdiffz))
400411
{
401-
// Launch the hdiff with the constructed arguments
402-
string arguments = "\"" + OGfbxPath + "\" \"" + CustomfbxPath+ "\" \"" + FBXDiffFile+ "\"";
403-
CommunFonctions.LaunchProgramWithArguments(hdiffz, arguments);
404-
//we do the same for the .meta file
405-
arguments = "\"" + OGfbxPath + ".meta\" \"" + CustomfbxPath + ".meta\" \"" + MetaDiffFile + "\"";
406-
CommunFonctions.LaunchProgramWithArguments(hdiffz, arguments);
412+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)){
413+
// Launch the hdiff with the constructed arguments
414+
string arguments = "\"" + OGfbxPath + "\" \"" + CustomfbxPath + "\" \"" + FBXDiffFile + "\"";
415+
CommunFonctions.LaunchProgramWithArguments(hdiffz, arguments);
416+
//we do the same for the .meta file
417+
arguments = "\"" + OGfbxPath + ".meta\" \"" + CustomfbxPath + ".meta\" \"" + MetaDiffFile + "\"";
418+
CommunFonctions.LaunchProgramWithArguments(hdiffz, arguments);
419+
}
420+
else
421+
{
422+
// Launch the hdiff with the constructed arguments
423+
string arguments = "/" + OGfbxPath + "/" + CustomfbxPath + "/" + FBXDiffFile + "/";
424+
CommunFonctions.LaunchProgramWithArguments(hdiffz, arguments);
425+
//we do the same for the .meta file
426+
arguments = "/" + OGfbxPath + ".meta/" + CustomfbxPath + ".meta/" + MetaDiffFile + "/";
427+
CommunFonctions.LaunchProgramWithArguments(hdiffz, arguments);
428+
}
429+
407430
}
408431
else
409432
{
410433
UnityEngine.Debug.Log("please make sure you have hdiffz.exe in: " + hdiffz);//need to add to the list of errors /!\ todo /!\
411434
}
412435

413-
hpatchzDestDir = Path.Combine(CommunFonctions.GoUpNDirs(outputDirectory, 1), "hdiff", "hpatchz.exe");
414-
string hpatchzLicenceDestDir = Path.Combine(CommunFonctions.GoUpNDirs(outputDirectory, 1), "hdiff", "License.txt");
415-
Directory.CreateDirectory(CommunFonctions.GoUpNDirs(hpatchzDestDir, 1));
436+
hpatchzDestDir = Path.Combine(CommunFonctions.GoUpNDirs(outputDirectory, 1), "hdiff", "hpatchz");
437+
Directory.CreateDirectory(hpatchzDestDir);
416438

417439
PatcherTemplateScript = Path.Combine(Environment.CurrentDirectory, "Assets", "Hash's_Things", "EditDistributor", "Editor", "PatcherTemplate.cs");
418440

@@ -424,8 +446,7 @@ private void BuildPatcher()
424446

425447

426448
Directory.CreateDirectory(CommunFonctions.GoUpNDirs(PatcherScriptDestDir, 1));
427-
CommunFonctions.CheckAndCopyFileIfExists(hpatchz, hpatchzDestDir);
428-
CommunFonctions.CheckAndCopyFileIfExists(hpatchzlicence, hpatchzLicenceDestDir);
449+
CommunFonctions.CopyFolder(hdiffzFolder, hpatchzDestDir);
429450
CommunFonctions.CheckAndCopyFileIfExists(PatcherTemplateScript, PatcherScriptDestDir);
430451

431452

DemoProject/Assets/Hash's_Things/EditDistributor/Editor/EditDistributorUpdater.cs

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.IO;
66
using System.Diagnostics;
77
using System.Collections;
8+
using System.Runtime.InteropServices;
89

910
namespace EditDistributor
1011
{
@@ -292,19 +293,35 @@ private void Updating()
292293
string outputDirectory = Path.Combine(CommunFonctions.GoUpNDirs(CustomfbxPath, 2), "patcher", "data", "DiffFiles");
293294

294295

295-
hdiffz = Path.Combine(Environment.CurrentDirectory, "Assets", "Hash's_Things", "EditDistributor", "hdiff", "hdiffz.exe");
296+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) hdiffz = Path.Combine(Environment.CurrentDirectory, "Assets", "Hash's_Things", "EditDistributor", "hdiff", "hdiffz", "Windows", "hdiffz.exe");
297+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) hdiffz = Path.Combine(Environment.CurrentDirectory, "Assets", "Hash's_Things", "EditDistributor", "hdiff", "hdiffz", "Linux", "hdiffz");
298+
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) hdiffz = Path.Combine(Environment.CurrentDirectory, "Assets", "Hash's_Things", "EditDistributor", "hdiff", "hdiffz", "Mac", "hdiffz");
299+
296300
FBXDiffFile = Path.Combine(outputDirectory, Path.GetFileNameWithoutExtension(OGfbxPath).Replace(" ", "_") + ".hdiff");
297301
MetaDiffFile = Path.Combine(outputDirectory, Path.GetFileNameWithoutExtension(OGfbxPath).Replace(" ", "_") + "Meta.hdiff");
298302

299303
if (File.Exists(hdiffz))
300304
{
301-
CommunFonctions.DeleteAllFilesInDirectory(outputDirectory);
302-
// Launch the hdiff with the constructed arguments
303-
string arguments = "\"" + OGfbxPath + "\" \"" + CustomfbxPath + "\" \"" + FBXDiffFile + "\"";
304-
CommunFonctions.LaunchProgramWithArguments(hdiffz, arguments);
305-
//we do the same for the .meta file
306-
arguments = "\"" + OGfbxPath + ".meta\" \"" + CustomfbxPath + ".meta\" \"" + MetaDiffFile + "\"";
307-
CommunFonctions.LaunchProgramWithArguments(hdiffz, arguments);
305+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
306+
{
307+
// Launch the hdiff with the constructed arguments
308+
string arguments = "\"" + OGfbxPath + "\" \"" + CustomfbxPath + "\" \"" + FBXDiffFile + "\"";
309+
CommunFonctions.LaunchProgramWithArguments(hdiffz, arguments);
310+
//we do the same for the .meta file
311+
arguments = "\"" + OGfbxPath + ".meta\" \"" + CustomfbxPath + ".meta\" \"" + MetaDiffFile + "\"";
312+
CommunFonctions.LaunchProgramWithArguments(hdiffz, arguments);
313+
}
314+
else
315+
{
316+
// Launch the hdiff with the constructed arguments
317+
string arguments = "/" + OGfbxPath + "/" + CustomfbxPath + "/" + FBXDiffFile + "/";
318+
CommunFonctions.LaunchProgramWithArguments(hdiffz, arguments);
319+
//we do the same for the .meta file
320+
arguments = "/" + OGfbxPath + ".meta/" + CustomfbxPath + ".meta/" + MetaDiffFile + "/";
321+
CommunFonctions.LaunchProgramWithArguments(hdiffz, arguments);
322+
}
323+
324+
308325
}
309326
else
310327
{

DemoProject/Assets/Hash's_Things/EditDistributor/Editor/PatcherTemplate.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.IO;
66
using System.Diagnostics;
77
using System.Collections;
8+
using System.Runtime.InteropServices;
89

910
public class PatcherTemplate : EditorWindow
1011
{
@@ -43,7 +44,11 @@ void OnGUI()
4344

4445
string currentCustomfbxPath = Application.dataPath + "/" + CustomfbxPath;
4546

46-
string hpatchz = Path.Combine(GoUpNDirs(currentCustomfbxPath, 2), "patcher", "data", "hdiff", "hpatchz.exe");
47+
string hpatchz = "";
48+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) hpatchz = Path.Combine(GoUpNDirs(currentCustomfbxPath, 2), "patcher", "data", "hdiff", "hpatchz", "Windows", "hpatchz.exe");
49+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) hpatchz = Path.Combine(GoUpNDirs(currentCustomfbxPath, 2), "patcher", "data", "hdiff", "hpatchz", "Linux", "hpatchz");
50+
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) hpatchz = Path.Combine(GoUpNDirs(currentCustomfbxPath, 2), "patcher", "data", "hdiff", "hpatchz", "Mac", "hpatchz");
51+
4752
string FBXDiffFile = Path.Combine(GoUpNDirs(currentCustomfbxPath, 2), "patcher", "data", "DiffFiles", Path.GetFileNameWithoutExtension(OGfbxPath).Replace(" ", "_") + ".hdiff");
4853
string MetaDiffFile = Path.Combine(GoUpNDirs(currentCustomfbxPath, 2), "patcher", "data", "DiffFiles", Path.GetFileNameWithoutExtension(OGfbxPath).Replace(" ", "_") + "Meta.hdiff");
4954
string fbxfolder = GoUpNDirs(currentCustomfbxPath, 1);

DemoProject/Assets/Hash's_Things/EditDistributor/hdiff/hdiffz.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

DemoProject/Assets/Hash's_Things/MyModifiedBlenderCube/patcher/data/hdiff/License.txt renamed to DemoProject/Assets/Hash's_Things/EditDistributor/hdiff/hdiffz/License.txt

File renamed without changes.

DemoProject/Assets/Hash's_Things/MyModifiedBlenderCube/patcher/data/hdiff/License.txt.meta renamed to DemoProject/Assets/Hash's_Things/EditDistributor/hdiff/hdiffz/License.txt.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

DemoProject/Assets/Hash's_Things/EditDistributor/hdiff/hdiffz/Linux.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.

DemoProject/Assets/Hash's_Things/EditDistributor/hdiff/hdiffz/Linux/hdiffz.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)