/** Returns true if this file is a directory. Always returns false for classpath files. On Android, an * {@link FileType#Internal} handle to an empty directory will return false. On the desktop, an {@link FileType#Internal} * handle to a directory on the classpath will return false. */ public boolean isDirectory () { if (type == FileType.Classpath) return false; return file().isDirectory(); }
/** Returns the last modified time in milliseconds for this file. Zero is returned if the file doesn't exist. Zero is returned * for {@link FileType#Classpath} files. On Android, zero is returned for {@link FileType#Internal} files. On the desktop, zero * is returned for {@link FileType#Internal} files on the classpath. */ public long lastModified () { return file().lastModified(); }
/** Returns true if the file exists. On Android, a {@link FileType#Classpath} or {@link FileType#Internal} handle to a * directory will always return false. Note that this can be very slow for internal files on Android! */ public boolean exists () { switch (type) { case Internal: if (file().exists()) return true; // Fall through. case Classpath: return FileHandle.class.getResource("/" + file.getPath().replace('\\', '/')) != null; } return file().exists(); }
/** @throws GdxRuntimeException if this file handle is a {@link FileType#Classpath} or {@link FileType#Internal} file. */ public void mkdirs () { if (type == FileType.Classpath) throw new GdxRuntimeException("Cannot mkdirs with a classpath file: " + file); if (type == FileType.Internal) throw new GdxRuntimeException("Cannot mkdirs with an internal file: " + file); file().mkdirs(); }
/** Deletes this file or empty directory and returns success. Will not delete a directory that has children. * @throws GdxRuntimeException if this file handle is a {@link FileType#Classpath} or {@link FileType#Internal} file. */ public boolean delete () { if (type == FileType.Classpath) throw new GdxRuntimeException("Cannot delete a classpath file: " + file); if (type == FileType.Internal) throw new GdxRuntimeException("Cannot delete an internal file: " + file); return file().delete(); }
/** Deletes this file or empty directory and returns success. Will not delete a directory that has children. * @throws GdxRuntimeException if this file handle is a {@link FileType#Classpath} or {@link FileType#Internal} file. */ public boolean delete () { if (type == FileType.Classpath) throw new GdxRuntimeException("Cannot delete a classpath file: " + file); if (type == FileType.Internal) throw new GdxRuntimeException("Cannot delete an internal file: " + file); return file().delete(); }
public void setTexture(Texture texture){ if(this.texture == texture) return; this.texture = texture; FileTextureData data = (FileTextureData)texture.getTextureData(); setImage(data.getFileHandle().file().getAbsolutePath()); }
public void setTexture(Texture texture){ if(this.texture == texture) return; this.texture = texture; FileTextureData data = (FileTextureData)texture.getTextureData(); setImage(data.getFileHandle().file().getAbsolutePath()); }
@Override public Music newMusic (FileHandle fileHandle) { String path = fileHandle.file().getPath().replace('\\', '/'); OALAudioTrack track = OALAudioTrack.create(); if (track != null) { if (track.preloadFile(path)) { return new IOSMusic(track); } } throw new GdxRuntimeException("Error opening music file at " + path); }
@Override public Music newMusic (FileHandle fileHandle) { String path = fileHandle.file().getPath().replace('\\', '/'); OALAudioTrack track = OALAudioTrack.create(); if (track != null) { if (track.preloadFile(path)) { return new IOSMusic(track); } } throw new GdxRuntimeException("Error opening music file at " + path); }
@Override public Music newMusic (FileHandle fileHandle) { String path = fileHandle.file().getPath().replace('\\', '/'); OALAudioTrack track = OALAudioTrack.alloc().init(); if (track != null) { if (track.preloadFile(path)) { return new IOSMusic(track); } } throw new GdxRuntimeException("Error opening music file at " + path); }
/** Deletes all children of this directory, recursively. Optionally preserving the folder structure. * @throws GdxRuntimeException if this file handle is a {@link FileType#Classpath} or {@link FileType#Internal} file. */ public void emptyDirectory (boolean preserveTree) { if (type == FileType.Classpath) throw new GdxRuntimeException("Cannot delete a classpath file: " + file); if (type == FileType.Internal) throw new GdxRuntimeException("Cannot delete an internal file: " + file); emptyDirectory(file(), preserveTree); }
@Override public Music newMusic (FileHandle fileHandle) { String path = fileHandle.file().getPath().replace('\\', '/'); OALAudioTrack track = OALAudioTrack.alloc().init(); if (track != null) { if (track.preloadFile(path)) { return new IOSMusic(track); } } throw new GdxRuntimeException("Error opening music file at " + path); }
/** Deletes this file or directory and all children, recursively. * @throws GdxRuntimeException if this file handle is a {@link FileType#Classpath} or {@link FileType#Internal} file. */ public boolean deleteDirectory () { if (type == FileType.Classpath) throw new GdxRuntimeException("Cannot delete a classpath file: " + file); if (type == FileType.Internal) throw new GdxRuntimeException("Cannot delete an internal file: " + file); return deleteDirectory(file()); }
/** Deletes this file or directory and all children, recursively. * @throws GdxRuntimeException if this file handle is a {@link FileType#Classpath} or {@link FileType#Internal} file. */ public boolean deleteDirectory () { if (type == FileType.Classpath) throw new GdxRuntimeException("Cannot delete a classpath file: " + file); if (type == FileType.Internal) throw new GdxRuntimeException("Cannot delete an internal file: " + file); return deleteDirectory(file()); }
/** Deletes all children of this directory, recursively. Optionally preserving the folder structure. * @throws GdxRuntimeException if this file handle is a {@link FileType#Classpath} or {@link FileType#Internal} file. */ public void emptyDirectory (boolean preserveTree) { if (type == FileType.Classpath) throw new GdxRuntimeException("Cannot delete a classpath file: " + file); if (type == FileType.Internal) throw new GdxRuntimeException("Cannot delete an internal file: " + file); emptyDirectory(file(), preserveTree); }
public IOSSound (FileHandle filePath) { soundPath = filePath.file().getPath().replace('\\', '/'); soundBuffer = OALSimpleAudio.sharedInstance().preloadEffect(soundPath); channel = OALSimpleAudio.sharedInstance().getChannelSource(); sourcePool = channel.getSourcePool().getSources(); }
public IOSSound (FileHandle filePath) { soundPath = filePath.file().getPath().replace('\\', '/'); soundBuffer = OALSimpleAudio.sharedInstance().preloadEffect(soundPath); channel = OALSimpleAudio.sharedInstance().getChannelSource(); sourcePool = channel.getSourcePool().getSources(); }
public IOSSound (FileHandle filePath) { soundPath = filePath.file().getPath().replace('\\', '/'); soundBuffer = OALSimpleAudio.sharedInstance().preloadEffect(soundPath); channel = OALSimpleAudio.sharedInstance().channel(); sourcePool = (NSArray<ALSource>)channel.sourcePool().sources(); }
public IOSSound (FileHandle filePath) { soundPath = filePath.file().getPath().replace('\\', '/'); soundBuffer = OALSimpleAudio.sharedInstance().preloadEffect(soundPath); channel = OALSimpleAudio.sharedInstance().channel(); sourcePool = (NSArray<ALSource>)channel.sourcePool().sources(); }