|
|
@@ -21,7 +21,8 @@ public class FileTool {
|
|
|
// 只要授权之后,是可以直接写这个路径的(注意是该文件夹有权限还就行,目标文件夹父文件夹有没有权限没关系),
|
|
|
// 但是由于jar包等冲突(或缺失),会导致war包发布的时候,没有真正运行,也就没有文件写进去了。
|
|
|
//private static final String PATH_AUTO_FOLDER = "/file/images/eden/auto/";
|
|
|
- //private static final String CMD_GET_AUTO_FILE_COUNT = "ls -l " + PATH_AUTO_FOLDER + " | grep \"^-\"|wc -l";
|
|
|
+ private static final String CMD_GET_AUTO_FILE_COUNT_PREFIX = "ls -l ";
|
|
|
+ private static final String CMD_GET_AUTO_FILE_COUNT_SUFFIX = " | grep \"^-\"|wc -l";
|
|
|
|
|
|
public static final String FORMAT_IMAGE = ".jpg";
|
|
|
public static final String FORMATTER_IMAGE_URL = "auto/%s";
|
|
|
@@ -33,9 +34,10 @@ public class FileTool {
|
|
|
//public static final String FORMATTER_TORRENT_URL = "torrent/%s";
|
|
|
|
|
|
//public static final String TARGET_DIR_AUTO_IMAGES = "F:\\eden\\images\\auto";
|
|
|
- public static final String TARGET_DIR_AUTO_IMAGES = "/file/eden/images/auto/";
|
|
|
+ public static final String TARGET_DIR_EDEN_ROOT = "/file/eden/";
|
|
|
+ public static final String TARGET_DIR_AUTO_IMAGES = TARGET_DIR_EDEN_ROOT + "images/auto/";
|
|
|
//public static final String TARGET_DIR_AUTO_TORRENT = "F:\\eden\\torrent\\auto";
|
|
|
- public static final String TARGET_DIR_AUTO_TORRENT = "/file/eden/torrent/auto/";
|
|
|
+ public static final String TARGET_DIR_AUTO_TORRENT = TARGET_DIR_EDEN_ROOT + "torrent/auto/";
|
|
|
|
|
|
private FileTool() {
|
|
|
}
|
|
|
@@ -64,8 +66,8 @@ public class FileTool {
|
|
|
}
|
|
|
|
|
|
// 获取下一文件名
|
|
|
- //int futureFileCount = getFilesCount(CMD_GET_AUTO_FILE_COUNT) + 1;
|
|
|
- int futureFileCount = getFilesCount(folder) + 1;
|
|
|
+ int futureFileCount = getFilesCount(CMD_GET_AUTO_FILE_COUNT_PREFIX + targetDir + CMD_GET_AUTO_FILE_COUNT_SUFFIX) + 1;
|
|
|
+ //int futureFileCount = getFilesCount(folder) + 1;
|
|
|
File file = new File(folder, String.valueOf(futureFileCount) + format);
|
|
|
if (file.exists()) {
|
|
|
file.delete();
|