Search in sources :

Example 1 with ShellLinkException

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;
    }
}
Also used : ShellLink(mslinks.ShellLink) IOException(java.io.IOException) File(java.io.File) ShellLinkException(mslinks.ShellLinkException)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 ShellLink (mslinks.ShellLink)1 ShellLinkException (mslinks.ShellLinkException)1