Eclipse xText get source and src-gen folder location

java xtext xtend

You can load a file from the resource folder as shown below

URL url = FileUtil.class.getProtectionDomain().getCodeSource().getLocation(); StringBuilder sb = new StringBuilder(); sb.append(new File(url.toURI()).getParentFile().toString()) .append(File.separator) .append(PROJECT_NAME) .apppend(File.separator) .append(FOLDER_NAME) .append(File.separator) .append(filename); File atLocation = new File(sb.toString());

The location of the src-gen folder is accessible like this

val outputPath = new File( ResourcesPlugin.workspace.root.getFile( new Path( resource.URI.toPlatformString(true) ) ) .rawLocation .toOSString) .getParentFile() .getParentFile() .toString + "/src-gen/"; // optional fileAccess.setOutputPath("src-gen/")


No known

History Mar 15, 2017