リポジトリ
使用例
通常
using System.IO;
using UnityEditor;
public class Example
{
[MenuItem( "Tools/Hoge" )]
private static void Hoge()
{
var path = "Assets/Scripts/Example.Generated.cs";
var dir = Path.GetDirectoryName( path );
Directory.CreateDirectory( dir );
File.WriteAllText( path, "ピカチュウ" );
}
}
UniDirectoryUtils
using Kogane;
using System.IO;
using UnityEditor;
public class Example
{
[MenuItem( "Tools/Hoge" )]
private static void Hoge()
{
var path = "Assets/Scripts/Example.Generated.cs";
DirectoryUtils.CreateDirectoryFromFilePath( path );
File.WriteAllText( path, "ピカチュウ" );
}
}