@Override public boolean contains(Location location, FileObject fo) throws IOException { validateFileObject(fo); Iterable<? extends File> files = getLocation(location); if (files == null) { throw new IllegalArgumentException("Unknown location : " + location);//$NON-NLS-1$ } for (File file : files) { if (file.isDirectory()) { if (fo instanceof EclipseFileObject) { Path filepath = ((EclipseFileObject) fo).f.toPath(); if (filepath.startsWith(Paths.get(file.toURI()).toAbsolutePath())) { return true; } } } else if (isArchive(file)) { if (fo instanceof ArchiveFileObject) { Archive archive = getArchive(file); if (archive != Archive.UNKNOWN_ARCHIVE) { if (archive.contains(((ArchiveFileObject) fo ).entryName)) { return true; } } } } } return false; }
if (archive.contains(normalizedFileName)) { return archive.getArchiveFileObject(normalizedFileName, this.charset);
if (archive.contains(normalizedFileName)) { return archive.getArchiveFileObject(normalizedFileName, this.charset);
public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException { Iterable<? extends File> files = getLocation(location); if (files == null) { throw new IllegalArgumentException("Unknown location : " + location);//$NON-NLS-1$ } String normalizedFileName = normalized(packageName) + '/' + relativeName.replace('\\', '/'); for (File file : files) { if (file.isDirectory()) { // handle directory File f = new File(file, normalizedFileName); if (f.exists()) { return new EclipseFileObject(packageName + File.separator + relativeName, f.toURI(), getKind(f), this.charset); } else { continue; // go to next entry in the location } } else if (isArchive(file)) { // handle archive file Archive archive = getArchive(file); if (archive != Archive.UNKNOWN_ARCHIVE) { if (archive.contains(normalizedFileName)) { return archive.getArchiveFileObject(normalizedFileName, this.charset); } } } } return null; }
if (archive.contains(normalizedFileName)) { return archive.getArchiveFileObject(normalizedFileName, this.charset);
if (archive.contains(normalizedFileName)) { return archive.getArchiveFileObject(normalizedFileName, this.charset);
if (archive.contains(normalizedFileName)) { return archive.getArchiveFileObject(normalizedFileName, this.charset);
public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException { Iterable<? extends File> files = getLocation(location); if (files == null) { throw new IllegalArgumentException("Unknown location : " + location);//$NON-NLS-1$ } String normalizedFileName = normalized(packageName) + '/' + relativeName.replace('\\', '/'); for (File file : files) { if (file.isDirectory()) { // handle directory File f = new File(file, normalizedFileName); if (f.exists()) { return new EclipseFileObject(packageName + File.separator + relativeName, f.toURI(), getKind(f), this.charset); } else { continue; // go to next entry in the location } } else if (isArchive(file)) { // handle archive file Archive archive = getArchive(file); if (archive != Archive.UNKNOWN_ARCHIVE) { if (archive.contains(normalizedFileName)) { return archive.getArchiveFileObject(normalizedFileName, this.charset); } } } } return null; }
public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException { Iterable<? extends File> files = getLocation(location); if (files == null) { throw new IllegalArgumentException("Unknown location : " + location);//$NON-NLS-1$ } String normalizedFileName = normalized(packageName) + '/' + relativeName.replace('\\', '/'); for (File file : files) { if (file.isDirectory()) { // handle directory File f = new File(file, normalizedFileName); if (f.exists()) { return new EclipseFileObject(packageName + File.separator + relativeName, f.toURI(), getKind(f), this.charset); } else { continue; // go to next entry in the location } } else if (isArchive(file)) { // handle archive file Archive archive = getArchive(file); if (archive != Archive.UNKNOWN_ARCHIVE) { if (archive.contains(normalizedFileName)) { return archive.getArchiveFileObject(normalizedFileName, this.charset); } } } } return null; }
@Override public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException { Iterable<? extends File> files = getLocation(location); if (files == null) { throw new IllegalArgumentException("Unknown location : " + location);//$NON-NLS-1$ } String normalizedFileName = normalizedFileName(packageName, relativeName); for (File file : files) { if (file.isDirectory()) { // handle directory File f = new File(file, normalizedFileName); if (f.exists()) { return new EclipseFileObject(packageName + File.separator + relativeName, f.toURI(), getKind(f), this.charset); } else { continue; // go to next entry in the location } } else if (isArchive(file)) { // handle archive file Archive archive = getArchive(file); if (archive != Archive.UNKNOWN_ARCHIVE) { if (archive.contains(normalizedFileName)) { return archive.getArchiveFileObject(normalizedFileName, this.charset); } } } } return null; }
if (archive.contains(normalizedFileName)) { return archive.getArchiveFileObject(normalizedFileName, null, this.charset);
@Override public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException { Iterable<? extends File> files = getLocation(location); if (files == null) { throw new IllegalArgumentException("Unknown location : " + location);//$NON-NLS-1$ } String normalizedFileName = normalizedFileName(packageName, relativeName); for (File file : files) { if (file.isDirectory()) { // handle directory File f = new File(file, normalizedFileName); if (f.exists()) { return new EclipseFileObject(packageName + File.separator + relativeName, f.toURI(), getKind(f), this.charset); } else { continue; // go to next entry in the location } } else if (isArchive(file)) { // handle archive file Archive archive = getArchive(file); if (archive != Archive.UNKNOWN_ARCHIVE) { if (archive.contains(normalizedFileName)) { return archive.getArchiveFileObject(normalizedFileName, this.charset); } } } } return null; }
@Override public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException { validateNonModuleLocation(location); Iterable<? extends File> files = getLocation(location); if (files == null) { throw new IllegalArgumentException("Unknown location : " + location);//$NON-NLS-1$ } String normalizedFileName = normalizedFileName(packageName, relativeName); for (File file : files) { if (file.isDirectory()) { // handle directory File f = new File(file, normalizedFileName); if (f.exists()) { return new EclipseFileObject(packageName + File.separator + relativeName, f.toURI(), getKind(f), this.charset); } else { continue; // go to next entry in the location } } else if (isArchive(file)) { // handle archive file Archive archive = getArchive(file); if (archive != Archive.UNKNOWN_ARCHIVE) { if (archive.contains(normalizedFileName)) { return archive.getArchiveFileObject(normalizedFileName, null, this.charset); } } } } return null; }