Permalink
Browse files

More install fixes

  • Loading branch information...
lmontoute committed Jan 8, 2019
1 parent 4411e3f commit 4f38db4f720a12f649bfcb97cfb911a1916515f8
Showing with 16 additions and 20 deletions.
  1. +0 −3 Editor/Utils/ReflectionHelpers.cs
  2. +16 −14 Install/FluvioFXInstall.cs
  3. +0 −3 Install/ReflectionHelpers.cs
@@ -49,9 +49,6 @@ static ReflectionHelpers()
}
else if (assembly.FullName.StartsWith("UnityEditor"))
{
// HACK
if (type.Name == "CSharpNamespaceParser") continue;

_editorTypeMap[type.Name] = type;
}
}
@@ -99,13 +99,13 @@ private static void Install(bool force = false)
var integrationFileExists = File.Exists($"{vfxPath}/Editor/FluvioFXIntegration.cs");

// VFXCodeGenerator.cs can't be found
var vfxCodeGenDir = $"{vfxPath}/Editor/Compiler";
var vfxCodeGenFileName = "VFXCodeGenerator.cs";
var vfxCodeGenPath = $"{vfxCodeGenDir}/{vfxCodeGenFileName}";
var vfxCodeGenPath = $"{vfxPath}/Editor/Compiler/VFXCodeGenerator.cs";
string vfxCodeGenFile;
try
{
vfxCodeGenFile = File.ReadAllText(vfxCodeGenPath);
vfxCodeGenFile = File
.ReadAllText(vfxCodeGenPath)
.Replace("\r\n", "\n");
}
catch
{
@@ -136,19 +136,20 @@ private static void Install(bool force = false)
{
// Modify VFXCodeGenerator.cs
vfxCodeGenFile = vfxCodeGenFile
.Replace(codeGenEventCallReplace, codeGenEventCall)
.Replace(codeGenEventReplace, codeGenEvent)
.Replace(codeGenEventCall, codeGenEventCallReplace)
.Replace(codeGenEvent, codeGenEventReplace);
.Replace(codeGenEventCallReplace.Replace("\r\n", "\n"), codeGenEventCall.Replace("\r\n", "\n"))
.Replace(codeGenEventReplace.Replace("\r\n", "\n"), codeGenEvent.Replace("\r\n", "\n"))
.Replace(codeGenEventCall.Replace("\r\n", "\n"), codeGenEventCallReplace.Replace("\r\n", "\n"))
.Replace(codeGenEvent.Replace("\r\n", "\n"), codeGenEventReplace.Replace("\r\n", "\n"));

try
{
SaveFile(vfxCodeGenDir, vfxCodeGenFileName, vfxCodeGenFile);
// Save VFXCodeGenerator.cs
SaveReadOnlyFile(vfxCodeGenPath, vfxCodeGenFile);

// Add integration file
// Add FluvioFXIntegration.cs
var integrationFilePath = $"{vfxPath}/Editor/FluvioFXIntegration.cs";
File.WriteAllText(integrationFilePath, integrationFile);
File.WriteAllText($"{integrationFilePath}.meta", integrationFileMeta);
SaveReadOnlyFile(integrationFilePath, integrationFile);
SaveReadOnlyFile($"{integrationFilePath}.meta", integrationFileMeta);

Debug.Log("FluvioFX install successful!");

@@ -207,12 +208,13 @@ private static void SetDefine(bool add)
}
}

private static void SaveFile(string directoryName, string filename, string text)
private static void SaveReadOnlyFile(string path, string text)
{
var path = Path.Combine(directoryName, filename);
path = path.Replace("\\", "/");

File.SetAttributes(path, FileAttributes.Normal);
File.WriteAllText(path, text);
File.SetAttributes(path, FileAttributes.ReadOnly);
}
}
}
@@ -49,9 +49,6 @@ static ReflectionHelpers()
}
else if (assembly.FullName.StartsWith("UnityEditor"))
{
// HACK
if (type.Name == "CSharpNamespaceParser") continue;

_editorTypeMap[type.Name] = type;
}
}

0 comments on commit 4f38db4

Please sign in to comment.