<commit_before>﻿using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEditor.AnimatedValues;
using UnityEngine;

namespace iBicha
{
    [System.Serializable]
    public class NativePlugin : ScriptableObject
    {
        public static NativePlugin GetDefault(EditorWindow editorWindow)
        {
            NativePlugin plugin = CreateInstance<NativePlugin>();
            plugin.Name = "MyPlugin";
            plugin.Version = "1.0.0.0";
            plugin.BuildNumber = 1;

            plugin.sectionAnimator = new AnimBool(false, editorWindow.Repaint);
            return plugin;
        }

        public string Name;
        public string Version;
        public int BuildNumber;

		public DefaultAsset pluginBinaryFolder;
        public string pluginBinaryFolderPath
        {
            get
            {
                if (pluginBinaryFolder == null)
                {
                    return "";
                }
                return Path.GetFullPath(AssetDatabase.GetAssetPath(pluginBinaryFolder));
            }
        }

        public string sourceFolder;
        public string buildFolder;

        #region GUI vars
        public AnimBool sectionAnimator;
        public bool isSelected;
        #endregion
        public void Create()
        {
            //THIS IS A LOT OF MESS. TO BE CONTINUED.
            //Escape name
            //check if exists

            FileUtil.CopyFileOrDirectory("Assets/NativePluginBuilder/Boilerplate~", "Assets/" + Name);

            FileUtil.MoveFileOrDirectory("Assets/" + Name + "/Plugin.cs", "Assets/" + Name + "/" + Name + ".cs");
            FileUtil.MoveFileOrDirectory("Assets/" + Name + "/PluginExample.cs", "Assets/" + Name + "/" + Name + "Example.cs");

            ProcessTemplateFile("Assets/" + Name + "/" + Name + ".cs");
            ProcessTemplateFile("Assets/" + Name + "/" + Name + "Example.cs");
            ProcessTemplateFile("Assets/" + Name + "/Plugins/WebGL/PluginJS.jslib");

			//Refresh to detect changes
			AssetDatabase.Refresh();

			//TODO: Make relative to root folder?
            sourceFolder = Path.GetFullPath("Assets/" + Name + "/NativeSource~/Source");
            buildFolder = Path.GetFullPath("Assets/" + Name + "/NativeSource~/Build");
			pluginBinaryFolder = AssetDatabase.LoadAssetAtPath<DefaultAsset>("Assets/" + Name + "/Plugins");
            AssetDatabase.CreateAsset(this, "Assets/" + Name + "/" + Name + ".asset");

            AssetDatabase.SaveAssets();

        }

        void ProcessTemplateFile(string filename)
        {
            string content = File.ReadAllText(filename);
            content = content.Replace("#PLUGIN_NAME#", Name);
            File.WriteAllText(filename, content);
        }

        public void Build()
        {
            CMakeHelper.Build(this, BuildTarget.StandaloneWindows, BuildType.Debug, Architecture.x86_64);
        }
    }
}<commit_msg>Create build folder before build<commit_after>﻿using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEditor.AnimatedValues;
using UnityEngine;

namespace iBicha
{
    [System.Serializable]
    public class NativePlugin : ScriptableObject
    {
        public static NativePlugin GetDefault(EditorWindow editorWindow)
        {
            NativePlugin plugin = CreateInstance<NativePlugin>();
            plugin.Name = "MyPlugin";
            plugin.Version = "1.0.0.0";
            plugin.BuildNumber = 1;

            plugin.sectionAnimator = new AnimBool(false, editorWindow.Repaint);
            return plugin;
        }

        public string Name;
        public string Version;
        public int BuildNumber;

		public DefaultAsset pluginBinaryFolder;
        public string pluginBinaryFolderPath
        {
            get
            {
                if (pluginBinaryFolder == null)
                {
                    return "";
                }
                return Path.GetFullPath(AssetDatabase.GetAssetPath(pluginBinaryFolder));
            }
        }

        public string sourceFolder;
        public string buildFolder;

        #region GUI vars
        public AnimBool sectionAnimator;
        public bool isSelected;
        #endregion
        public void Create()
        {
            //THIS IS A LOT OF MESS. TO BE CONTINUED.
            //Escape name
            //check if exists

            FileUtil.CopyFileOrDirectory("Assets/NativePluginBuilder/Boilerplate~", "Assets/" + Name);

            FileUtil.MoveFileOrDirectory("Assets/" + Name + "/Plugin.cs", "Assets/" + Name + "/" + Name + ".cs");
            FileUtil.MoveFileOrDirectory("Assets/" + Name + "/PluginExample.cs", "Assets/" + Name + "/" + Name + "Example.cs");

            ProcessTemplateFile("Assets/" + Name + "/" + Name + ".cs");
            ProcessTemplateFile("Assets/" + Name + "/" + Name + "Example.cs");
            ProcessTemplateFile("Assets/" + Name + "/Plugins/WebGL/PluginJS.jslib");

			//Refresh to detect changes
			AssetDatabase.Refresh();

			//TODO: Make relative to root folder?
            sourceFolder = Path.GetFullPath("Assets/" + Name + "/NativeSource~/Source");
            buildFolder = Path.GetFullPath("Assets/" + Name + "/NativeSource~/Build");
			pluginBinaryFolder = AssetDatabase.LoadAssetAtPath<DefaultAsset>("Assets/" + Name + "/Plugins");
            AssetDatabase.CreateAsset(this, "Assets/" + Name + "/" + Name + ".asset");

            AssetDatabase.SaveAssets();

        }

        void ProcessTemplateFile(string filename)
        {
            string content = File.ReadAllText(filename);
            content = content.Replace("#PLUGIN_NAME#", Name);
            File.WriteAllText(filename, content);
        }

        public void Build()
        {
			if (!Directory.Exists(buildFolder)) {
				Directory.CreateDirectory (buildFolder);
			}
			CMakeHelper.Build(this, BuildTarget.StandaloneOSXUniversal, BuildType.Debug, Architecture.x86_64);
        }
    }
}
{'fraction_non_alphanumeric': 0.11147976111479761, 'fraction_numerical': 0.0029860650298606504, 'mean_word_length': 2.1368366285119667, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6533889', 'n_tokens_mistral': 1640, 'n_tokens_neox': 1554, 'n_words': 350}