|
|
@ -261,9 +261,7 @@ public class LccMapService { |
|
|
} |
|
|
} |
|
|
return list; |
|
|
return list; |
|
|
} |
|
|
} |
|
|
|
|
|
public void saveScripts(String projectUuid, List<Map<String, Object>> scriptList) { |
|
|
|
|
|
|
|
|
public List<Map<String, String>> saveAndSyncScripts(String projectUuid, List<Map<String, Object>> scriptList) { |
|
|
|
|
|
var mapLoc = new File(this.config.getLocation()); |
|
|
var mapLoc = new File(this.config.getLocation()); |
|
|
|
|
|
|
|
|
// 扫描 mapLoc 目录下所有的文件夹,并且文件夹中包含有 project.json 文件存在,就讲她反序列化为 LccProject 对象
|
|
|
// 扫描 mapLoc 目录下所有的文件夹,并且文件夹中包含有 project.json 文件存在,就讲她反序列化为 LccProject 对象
|
|
|
@ -295,6 +293,23 @@ public class LccMapService { |
|
|
File scriptFile = new File(scriptsDir, name + ".ts"); |
|
|
File scriptFile = new File(scriptsDir, name + ".ts"); |
|
|
LccUtils.saveFile(scriptFile, content, "script"); |
|
|
LccUtils.saveFile(scriptFile, content, "script"); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<Map<String, String>> syncScripts(String projectUuid) { |
|
|
|
|
|
var mapLoc = new File(this.config.getLocation()); |
|
|
|
|
|
|
|
|
|
|
|
// 扫描 mapLoc 目录下所有的文件夹,并且文件夹中包含有 project.json 文件存在,就讲她反序列化为 LccProject 对象
|
|
|
|
|
|
if (!mapLoc.exists() || !mapLoc.isDirectory()) { |
|
|
|
|
|
throw new RuntimeException( |
|
|
|
|
|
String.format("LccMapService.getAllProjects() - mapLoc '%s' does not exist or is not a directory", mapLoc.getAbsolutePath()) |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var scriptsDir = new File(mapLoc, projectUuid + "/scripts"); |
|
|
|
|
|
if (!scriptsDir.exists()) { |
|
|
|
|
|
log.warn("Script directory '{}' does not exist, returning empty script list.", scriptsDir.getAbsolutePath()); |
|
|
|
|
|
return Lists.newArrayList(); // 如果脚本目录不存在,返回空列表
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 读取脚本文件夹内所有文件,返回给前端
|
|
|
// 读取脚本文件夹内所有文件,返回给前端
|
|
|
List<Map<String, String>> scriptListNew = Lists.newArrayList(); |
|
|
List<Map<String, String>> scriptListNew = Lists.newArrayList(); |
|
|
|