You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
753 B
C#
23 lines
753 B
C#
namespace Fusion.Editor {
|
|
using System.IO;
|
|
using UnityEditor.AssetImporters;
|
|
using UnityEngine;
|
|
|
|
[ScriptedImporter(0, "editorconfig")]
|
|
class FusionEditorConfigImporter : ScriptedImporter {
|
|
public override void OnImportAsset(AssetImportContext ctx) {
|
|
var path = ctx.assetPath;
|
|
var contents = File.ReadAllText(path);
|
|
|
|
// create internal text asset for convenience
|
|
var mainAsset = new TextAsset(contents);
|
|
ctx.AddObjectToAsset("main", mainAsset);
|
|
ctx.SetMainObject(mainAsset);
|
|
|
|
// write the actual editorconfig for editors to consume
|
|
var editorConfigPath = Path.Combine(Path.GetDirectoryName(path), ".editorconfig");
|
|
File.WriteAllText(editorConfigPath, contents);
|
|
}
|
|
}
|
|
}
|