fix 扫描音乐文件夹内部无法处理含有+号的目录

This commit is contained in:
Yutousama 2021-07-04 14:19:00 +08:00
parent 4ffd94e3d1
commit d8acadf2d7

View File

@ -114,11 +114,12 @@ public class MusicToolsServiceImpl implements IMusicToolsService {
MusicDataExample example = new MusicDataExample(); MusicDataExample example = new MusicDataExample();
String replacement = "windows".equals(ConfigTools.load(ConfigTools.CONFIG, "os")) ? "\\\\" : "/"; String replacement = "windows".equals(ConfigTools.load(ConfigTools.CONFIG, "os")) ? "\\\\" : "/";
String tmpPath = path; String tmpPath = path;
if (new File(path).isDirectory()) { if (isDir) {
example.createCriteria().andFileLike(tmpPath.replace(File.separator, replacement) + "%"); example.createCriteria().andFileLike(tmpPath.replace(File.separator, replacement) + "%");
main = musicDataDao.selectByExample(example); main = musicDataDao.selectByExample(example);
} }
tmpPath = tmpPath.replace(File.separator, replacement) tmpPath = tmpPath.replace(File.separator, replacement)
.replace("+", "\\+")
.replace("[", "\\[") .replace("[", "\\[")
.replace("(", "\\(") .replace("(", "\\(")
.replace(")", "\\)") .replace(")", "\\)")