RCP FileSystem 文件系统

public static File toLocalFile(String folderName){
		try {
			URL url = Activator.getDefault().getBundle().getEntry(folderName);
			url = FileLocator.toFileURL(url);
			IFileSystem fs = EFS.getLocalFileSystem();
			IFileStore file = fs.getStore(new Path(url.getPath()));
			IFileStore fileStore = file.getFileStore(new Path(""));
			File file2 =  fileStore.toLocalFile(EFS.NONE, null);
			 
			
			return file2;
		} catch (IOException e) {
			e.printStackTrace();
		} catch (CoreException e) {
			e.printStackTrace();
		}
		return null;
	}

 RCP在运行时环境获得jar包中的文件,开发时可以获得工程下的文件和文件夹

你可能感兴趣的:(RCP FileSystem 文件系统)