package com.o2o.util;
public class PathUtil {
//获取当前系统是以“/”还是“\”为路径
private static String seperator=System.getProperty("file.separator");
public static String getImgBasePath() {
//获取操作系统
String os=System.getProperty("os.name");
String basePath="";
//判断是否是Windows系统
if(os.toLowerCase().startsWith("win")) {
basePath="D:/project/o2o/image";
}else {
basePath="/home/o2o/image";
}
basePath=basePath.replace("/", seperator);
return basePath;
}
//根据shopId创建图片相对路径
public static String getShopImagePath(long shopId) {
String imagePath="/upload/item/shop/"+shopId+"/";
return imagePath.replace("/", seperator);
}
}