/** Returns a handle to the child with the specified name. */ public FileHandle child (String name) { if (file.getPath().length() == 0) return new FileHandle(new File(name), type); return new FileHandle(new File(file, name), type); }
public FileHandle parent () { File parent = file.getParentFile(); if (parent == null) { if (type == FileType.Absolute) parent = new File("/"); else parent = new File(""); } return new FileHandle(parent, type); }
/** Returns a handle to the child with the specified name. */ public FileHandle child (String name) { if (file.getPath().length() == 0) return new FileHandle(new File(name), type); return new FileHandle(new File(file, name), type); }
public FileHandle parent () { File parent = file.getParentFile(); if (parent == null) { if (type == FileType.Absolute) parent = new File("/"); else parent = new File(""); } return new FileHandle(parent, type); }
@Override protected void processFile (Entry inputFile) throws Exception { filesScanned++; String content = new FileHandle(inputFile.inputFile).readString(); if (content.trim().startsWith("package")) { System.out.println("File '" + inputFile.inputFile + "' header fixed"); filesChanged++; BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileHandle(inputFile.outputFile).write(false))); writer.write(header + "\n\n" + content); writer.close(); } }
@Override protected void processFile (Entry inputFile) throws Exception { filesScanned++; String content = new FileHandle(inputFile.inputFile).readString(); if (content.trim().startsWith("package")) { System.out.println("File '" + inputFile.inputFile + "' header fixed"); filesChanged++; BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileHandle(inputFile.outputFile).write(false))); writer.write(header + "\n\n" + content); writer.close(); } }
/** Returns a handle to the sibling with the specified name. * @throws GdxRuntimeException if this file is the root. */ public FileHandle sibling (String name) { if (file.getPath().length() == 0) throw new GdxRuntimeException("Cannot get the sibling of the root."); return new FileHandle(new File(file.getParent(), name), type); }
/** Returns a handle to the sibling with the specified name. * @throws GdxRuntimeException if this file is the root. */ public FileHandle sibling (String name) { if (file.getPath().length() == 0) throw new GdxRuntimeException("Cannot get the sibling of the root."); return new FileHandle(new File(file.getParent(), name), type); }
public static void main (String[] args) { FileHandle file = new FileHandle(args[0]); StringBuffer list = new StringBuffer(); args[0] = args[0].replace("\\", "/"); if (!args[0].endsWith("/")) args[0] = args[0] + "/"; traverse(file, args[0], list); new FileHandle(args[0] + "/assets.txt").writeString(list.toString(), false); }
static public FileHandle tempDirectory (String prefix) { try { File file = File.createTempFile(prefix, null); if (!file.delete()) throw new IOException("Unable to delete temp file: " + file); if (!file.mkdir()) throw new IOException("Unable to create temp directory: " + file); return new FileHandle(file); } catch (IOException ex) { throw new GdxRuntimeException("Unable to create temp file.", ex); } }
static public FileHandle tempFile (String prefix) { try { return new FileHandle(File.createTempFile(prefix, null)); } catch (IOException ex) { throw new GdxRuntimeException("Unable to create temp file.", ex); } }
static public FileHandle tempDirectory (String prefix) { try { File file = File.createTempFile(prefix, null); if (!file.delete()) throw new IOException("Unable to delete temp file: " + file); if (!file.mkdir()) throw new IOException("Unable to create temp directory: " + file); return new FileHandle(file); } catch (IOException ex) { throw new GdxRuntimeException("Unable to create temp file.", ex); } }
static public FileHandle tempFile (String prefix) { try { return new FileHandle(File.createTempFile(prefix, null)); } catch (IOException ex) { throw new GdxRuntimeException("Unable to create temp file.", ex); } }
static public String getAtlasName (String name, boolean flattenPaths) { return flattenPaths ? new FileHandle(name).name() : name; } }
public IOSFiles () { new FileHandle(externalPath).mkdirs(); new FileHandle(localPath).mkdirs(); }
public IOSFiles () { new FileHandle(externalPath).mkdirs(); new FileHandle(localPath).mkdirs(); }
public HeaderFileProcessor () { header = new FileHandle("assets/licence-header.txt").readString(); addInputSuffix(".java"); setFlattenOutput(false); setRecursive(true); }
public HeaderFileProcessor () { header = new FileHandle("assets/licence-header.txt").readString(); addInputSuffix(".java"); setFlattenOutput(false); setRecursive(true); }
@Override public FileHandle resolve (String fileName) { Resolution bestResolution = choose(descriptors); FileHandle originalHandle = new FileHandle(fileName); FileHandle handle = baseResolver.resolve(resolve(originalHandle, bestResolution.folder)); if (!handle.exists()) handle = baseResolver.resolve(fileName); return handle; }
@Override public FileHandle resolve (String fileName) { Resolution bestResolution = choose(descriptors); FileHandle originalHandle = new FileHandle(fileName); FileHandle handle = baseResolver.resolve(resolve(originalHandle, bestResolution.folder)); if (!handle.exists()) handle = baseResolver.resolve(fileName); return handle; }