use of mslinks.ShellLinkException in project TeachingInSimulation by ScOrPiOzzy.
the class LnkParser2 method parser.
private File parser(File file) {
if (isLnkFile(file)) {
try {
ShellLink link = new ShellLink(file.getAbsolutePath());
String ext = FileUtil.getFileExt(link.getLinkInfo().getLocalBasePath());
String realPath = link.getWorkingDir() + File.separator + file.getName().replaceAll("lnk", ext);
return new File(realPath);
} catch (IOException e) {
e.printStackTrace();
} catch (ShellLinkException e) {
e.printStackTrace();
}
System.err.println(String.format("未找到快捷方式:%s的真实路径", file.getAbsolutePath()));
return null;
} else {
return file;
}
}
Aggregations