/** * Attempts to include the given file. * * User code may override this method to implement a virtual * file system. */ protected boolean include(VirtualFile file) throws IOException, LexerException { // System.out.println("Try to include " + file); if (!file.isFile()) return false; if (getFeature(Feature.DEBUG)) System.err.println("pp: including " + file); push_source(file.getSource(), true); return true; }
public List<String> run() throws SoShaderException { try { final SoShaderPreprocessorJCPP p = SoShaderPreprocessorJCPP.this; this.pp.setSystemIncludePath(p.modules); this.pp.setFileSystem(p.filesystem); this.pp.addInput(p.filesystem.getFile(this.file).getSource()); this.pp.setListener(this); this.setupDefines(); final int bsize = 2 << 14; try (final ByteArrayOutputStream bao = new ByteArrayOutputStream(bsize)) { this.processTokens(bao); return this.processLines(bao); } } catch (final IOException e) { throw new SoShaderExceptionIO(e); } }
if (!inIncludeNext && parent != null) { VirtualFile pfile = parent == null ? null : filesystem.getFile(parent); pdir = pfile == null ? null : pfile.getParentFile(); VirtualFile ifile = pdir.getChildFile(name); if (include(ifile)) return; VirtualFile ifile = pdir.getChildFile(subName); if (include(ifile)) return;
if (!inIncludeNext && parent != null) { VirtualFile pfile = parent == null ? null : filesystem.getFile(parent); pdir = pfile == null ? null : pfile.getParentFile(); VirtualFile ifile = pdir.getChildFile(name); if (include(ifile)) return; VirtualFile ifile = pdir.getChildFile(subName); if (include(ifile)) return;
/** * Attempts to include the given file. * * User code may override this method to implement a virtual * file system. */ protected boolean include(VirtualFile file) throws IOException, LexerException { // System.out.println("Try to include " + file); if (!file.isFile()) return false; if (getFeature(Feature.DEBUG)) System.err.println("pp: including " + file); push_source(file.getSource(), true); return true; }
if (parent != null) { VirtualFile pfile = filesystem.getFile(parent); pdir = pfile.getParentFile(); VirtualFile ifile = pdir.getChildFile(name); if (include(ifile)) return;
/** * Attempts to include the given file. * * User code may override this method to implement a virtual * file system. * * @param file The VirtualFile to attempt to include. * @return true if the file was successfully included, false otherwise. * @throws IOException if an I/O error occurs. */ protected boolean include(@Nonnull VirtualFile file) throws IOException { // System.out.println("Try to include " + ((File)file).getAbsolutePath()); if (!file.isFile()) return false; if (getFeature(Feature.DEBUG)) LOG.debug("pp: including " + file); includes.add(file); push_source(file.getSource(), true); return true; }
public void testJavaFileSystem() throws Exception { JavaFileSystem fs = new JavaFileSystem(); VirtualFile f; /* Anyone who has this file on their Unix box is messed up. */ f = fs.getFile("/foo/bar baz"); try { f.getSource(); /* drop on floor */ assertTrue("Got a source for a non-file", f.isFile()); } catch (FileNotFoundException e) { assertFalse("Got no source for a file", f.isFile()); } /* We hope we have this. */ f = fs.getFile("/usr/include/stdio.h"); try { f.getSource(); /* drop on floor */ System.out.println("Opened stdio.h"); assertTrue("Got a source for a non-file", f.isFile()); } catch (FileNotFoundException e) { System.out.println("Failed to open stdio.h"); assertFalse("Got no source for a file", f.isFile()); } }
@Test public void testJavaFileSystem() throws Exception { JavaFileSystem fs = new JavaFileSystem(); VirtualFile f; /* Anyone who has this file on their Unix box is messed up. */ f = fs.getFile("/foo/bar baz"); try { f.getSource(); /* drop on floor */ assertTrue("Got a source for a non-file", f.isFile()); } catch (FileNotFoundException e) { assertFalse("Got no source for a file", f.isFile()); } /* We hope we have this. */ f = fs.getFile("/usr/include/stdio.h"); try { f.getSource(); /* drop on floor */ System.out.println("Opened stdio.h"); assertTrue("Got a source for a non-file", f.isFile()); } catch (FileNotFoundException e) { System.out.println("Failed to open stdio.h"); assertFalse("Got no source for a file", f.isFile()); } }