package com.northglass.util;
|
|
import java.io.File;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
|
@Component
|
public class FolderUtil {
|
|
public static String WEB_ROOT_PATH;
|
public static String TEMP_PATH;
|
public static String PATH;
|
|
public FolderUtil(HttpServletRequest request) {
|
if (WEB_ROOT_PATH == null || WEB_ROOT_PATH.equals("")) {
|
WEB_ROOT_PATH = request.getSession().getServletContext().getRealPath("/");
|
System.out.println("WEB_ROOT_PATH: " + WEB_ROOT_PATH);
|
|
TEMP_PATH = WEB_ROOT_PATH + File.separator + "static" + File.separator + "temp";
|
System.out.println("TEMP_PATH: " + TEMP_PATH);
|
|
File tempDir = new File(TEMP_PATH);
|
if (!tempDir.exists()) {
|
tempDir.mkdirs();
|
}
|
}
|
|
}
|
public FolderUtil() {
|
// TODO Auto-generated constructor stub
|
}
|
// public void downOpt(HttpServletRequest request,Long loadmachineid){
|
// if (WEB_ROOT_PATH == null || WEB_ROOT_PATH.equals("")) {
|
// LoadMachine loadmachine = new CutManageService().getLoadmachine(loadmachineid);
|
// PATH = loadmachine.getPath();
|
// File tempDir = new File(PATH);
|
//
|
//
|
// if (!tempDir.exists()) {
|
// tempDir.mkdirs();
|
// }
|
// }
|
// }
|
|
}
|