• Eclipse插件开发中File和IFile的转换


    (1) File转IFile

      第一种方法:

        IFile[] ifile = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(file.toURI());

      第二种方法:

        String filepath =file.getPath();

        IProject proj =ResourcesPlugin.getWorkspace().getRoot().getProject(projName);

        String path =filepath.substring(proj.getLocation().toString().length() + 1);

        IFile file =proj.getFile(path);  

    (2) IFile转File

      File file = ifile.getLocation().toFile;

        或者

      File = newFile(ifile.getLocation().toOSString);   

  • 相关阅读:
    Python文件的两种用途
    模块的搜索路径
    循环导入问题
    import和from...import
    模块的四种形式
    函数小结
    面向过程编程
    内置函数
    匿名函数
    递归
  • 原文地址:https://www.cnblogs.com/Soy-technology/p/11428277.html
Copyright © 2020-2023  润新知