auto generate file & info

 avatar
unknown
csharp
2 years ago
759 B
6
Indexable
using UnityEngine;
using System.IO;
using static System.Environment;
using System;

public class JsonFile : MonoBehaviour 
{
    

    public void Start()
    {
        CreateFile2();
    }

    public void CreateFile2()
    {
        string folderName = ".openai";
        string fileName = "auth.json";
        string folderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), folderName);
        string filePath = Path.Combine(folderPath, fileName);

        if (!Directory.Exists(folderPath))
        {
            Directory.CreateDirectory(folderPath);
        }
                              FileName     Info
        string jsonData = "{\"########\":\"#####\" }";
        File.WriteAllText(filePath, jsonData);
    }
}
Editor is loading...