use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.
the class FileLocationsImpl method getTargetFolder.
@Override
public Path getTargetFolder(final Path path) {
Path _xblockexpression = null;
{
final Path projectFolder = this.getProjectFolder(path);
if ((projectFolder == null)) {
return null;
}
final OutputConfiguration outputConfiguration = IterableExtensions.<OutputConfiguration>head(this.outputConfigurationProvider.getOutputConfigurations(this.context));
final Path sourceFolder = this.getSourceFolder(path);
String _xifexpression = null;
if ((sourceFolder == null)) {
_xifexpression = outputConfiguration.getOutputDirectory();
} else {
String _xblockexpression_1 = null;
{
final String projectRelativeSourceFolder = IterableExtensions.join(IterableExtensions.<String>tail(sourceFolder.getSegments()), "/");
_xblockexpression_1 = outputConfiguration.getOutputDirectory(projectRelativeSourceFolder);
}
_xifexpression = _xblockexpression_1;
}
final String outputFolder = _xifexpression;
_xblockexpression = projectFolder.append(outputFolder);
}
return _xblockexpression;
}
use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.
the class JavaIOFileSystemSupport method getChildren.
@Override
public Iterable<? extends Path> getChildren(final URI uri, final Path path) {
java.net.URI _uRI = this.toURI(uri);
final Function1<String, Path> _function = (String it) -> {
return path.getAbsolutePath(it);
};
return ListExtensions.<String, Path>map(((List<String>) Conversions.doWrapArray(new File(_uRI).list())), _function);
}
use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.
the class __GeneratedSourceModifingAnnotationProcessor method doGenerateCode.
@Override
public void doGenerateCode(final ClassDeclaration annotatedClass, @Extension final CodeGenerationContext context) {
final Path targetFolder = context.getTargetFolder(annotatedClass.getCompilationUnit().getFilePath());
String _lastSegment = targetFolder.getLastSegment();
boolean _equals = Objects.equal(_lastSegment, "xtend-gen");
Assert.assertTrue(_equals);
}
use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.
the class JavaIoFileSystemTest method testMakeAndDeleteFile.
@Test
public void testMakeAndDeleteFile() {
final Path path = new Path("/foo/src/my/pack/Foo.txt");
Assert.assertFalse(this.fs.exists(path));
this.fs.setContents(path, "Hello Foo");
Assert.assertTrue(this.fs.exists(path));
Assert.assertEquals("Hello Foo", this.fs.getContents(path));
Assert.assertTrue(this.fs.isFile(path));
Assert.assertFalse(this.fs.isFolder(path));
this.fs.delete(path);
Assert.assertFalse(this.fs.exists(path));
Assert.assertFalse(this.fs.isFile(path));
Assert.assertFalse(this.fs.isFolder(path));
}
use of org.eclipse.xtend.lib.macro.file.Path in project xtext-xtend by eclipse.
the class JavaIoFileSystemTest method createProject.
protected Object createProject(final String name) {
URI _uRI = this.fs.toURI(new Path(name));
final File file = new File(_uRI);
file.mkdirs();
return file;
}
Aggregations