private static void St2() { var shouldBeIgnoredInBuildScripts = new List <string>(); foreach (var path in RoFile.Ls(EditorEnv.assetsPath)) { if (RoFile.IsDir(path)) { if (RoFile.Basename(path).IsMatch("(Editor|Script|Standard Assets)")) { continue; } var fs = RoFile.FF(path); fs.Each((path2) => { if (path2.IsMatch("\\.cs$") && !RoFile.Read(path2).IsMatch("#if UNITY_EDITOR")) { shouldBeIgnoredInBuildScripts.Add(path2); } }); } } if (shouldBeIgnoredInBuildScripts.Count > 0) { throw new SystemException( "following code should be marked #if UNITY_EDITOR to only run in unity editor not unity build" + "\n" + shouldBeIgnoredInBuildScripts.Join("\n")); } }
public static void St() { Thr(() => { var editorScriptsDir = RoFile.Join(EditorEnv.assetsPath, "EditorScript/Ro"); if (RoFile.IsDir(editorScriptsDir)) { var shouldMarkIf_UNITY_EDITOR_scripts = new List <string>(); RoFile.FF(editorScriptsDir).Each((path) => { if (path.IsMatch("\\.cs$") && !RoFile.Read(path).IsMatch("#if\\s+UNITY_EDITOR")) { Notify($"wrap with #if UNITY_EDITOR, script: {path}"); RoFile.Write(path, $"#if UNITY_EDITOR\n{RoFile.Read(path)}\n#endif"); } }); } // var shouldMarkStr = shouldMarkIf_UNITY_EDITOR_scripts.Map((script) => { return $" {script}"; }) // .Join("\n"); // throw new SystemException( // $"following scripts should mark #if UNITY_EDITOR\n{shouldMarkStr}"); }); }