auto generate file & info

mail@pastecode.io avatar
unknown
csharp
a year ago
765 B
5
Indexable
Never
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);
        }

        string jsonData = "{\"private_api_key\":\"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\" }";
        File.WriteAllText(filePath, jsonData);
    }
}