package com.hotent.util;/**
 * @program: cbjs-mvue-master
 * @description:
 * @author: zhao yue yue
 * @create: 2025-11-28 09:43
 */

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;


/**
 *@author: zhao yue yue
 *@create: 2025-11-28 09:43
 */
public class FileUtils {

    public static FileOutputStream createFileOutputStream(String filePath) throws IOException {
        File file = new File(filePath);

        // 确保目录存在
        File parentDir = file.getParentFile();
        if (parentDir != null && !parentDir.exists()) {
            boolean created = parentDir.mkdirs();
            if (!created) {
                throw new IOException("无法创建目录: " + parentDir.getAbsolutePath());
            }
        }

        return new FileOutputStream(file);
    }
}
