我正在尝试使用扩展.xmi保存EMF模型。但我无法做到这一点,因为我在开发和运行时都看不到任何错误。
如果我将它保存在默认位置,也就是platform:/resource/CompanyToIT/instances/corr-2019_08_31-19_24_52.xmi,那么get就被保存了。但是当我尝试选择一个不同的位置时,比如C:\Users\PC\Desktop\XMI,它不会保存它,因为我看不到该位置的文件(我也尝试将platform:添加到路径中,没有成功)。
下面是我正在使用的函数。这是从运行时环境UI调用的。UI将路径和资源一起传递给此函数。
private void saveModel(Resource r, String time, String newLocation) throws IOException {
String newPath;
URI newUri;
newPath = FilenameUtils.getFullPath(newLocation);
newPath += FilenameUtils.getBaseName(newLocation) + "-";
newPath += time + "." + FilenameUtils.getExtension(newLocation);
newUri = URI.createURI(newPath);
r.setURI(newUri);
r.save(null);
}任何帮助都将不胜感激。谢谢!
发布于 2019-09-02 15:20:35
https://stackoverflow.com/questions/57746024
复制相似问题