本文整理匯總了Java中com.badlogic.gdx.files.FileHandle.delete方法的典型用法代碼示例。如果您正苦於以下問題:Java FileHandle.delete方法的具體用法?Java FileHandle.delete怎麽用?Java FileHandle.delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.files.FileHandle
的用法示例。
在下文中一共展示了FileHandle.delete方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: action
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
@Override
public void action() {
if (!visited) {
text = "YOU WILL LOSE PROGRESS. OK?";
visited = true;
} else {
resetVisited();
soundtrackManager.stopSound();
inputProcessor.activate();
inputProcessor.saveConfiguration();
FileHandle file = Gdx.files.local("state.sav");
if (file.exists()) {
file.delete();
}
ggvm.reset();
menu = topLevelMenu;
}
}
示例2: createSceneFile
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
private FileHandle createSceneFile(float width,float height,String name) throws IOException {
if (!path.isDirectory()){
path = path.parent();
}
StringBuilder filePath = new StringBuilder();
filePath.append(path.path());
filePath.append("/");
filePath.append(name);
filePath.append(".");
filePath.append(Config.sceneExtension);
FileHandle fileHandle = new FileHandle(filePath.toString());
if (fileHandle.file().exists()) fileHandle.delete();
fileHandle.file().createNewFile();
Writer writer = new FileWriter(fileHandle.file());
FileUtils.createScene(writer,width,height,name);
writer.close();
return fileHandle;
}
示例3: read
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
public static boolean read() {
FileHandle fileHandle = Compatibility.get().getBaseFolder().child("settings.json");
try {
Reader reader = fileHandle.reader();
JsonObject json = Json.parse(reader).asObject();
reader.close();
for (Member member : json) {
Setting setting = set.settings.get(member.getName());
setting.readJson(member.getValue());
}
return true;
} catch (Exception e) {
Log.error("Failed to read settings", e);
fileHandle.delete();
return false;
}
}
示例4: write
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
public static boolean write() {
FileHandle fileHandle = Compatibility.get().getBaseFolder().child("settings.json");
JsonObject json = new JsonObject();
for (Map.Entry<String, Setting> entry : settings.entrySet()) {
json.set(entry.getKey(), entry.getValue().toJson());
}
try {
Writer writer = fileHandle.writer(false);
json.writeTo(writer, WriterConfig.PRETTY_PRINT);
writer.close();
} catch (Exception e) {
Log.error("Failed to write settings", e);
fileHandle.delete();
return false;
}
return true;
}
示例5: read
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
public static boolean read() {
FileHandle fileHandle = Compatibility.get().getBaseFolder().child("settings.json");
try {
Reader reader = fileHandle.reader();
JsonObject json = Json.parse(reader).asObject();
reader.close();
for (Member member : json) {
Setting setting = settings.get(member.getName());
setting.readJson(member.getValue());
}
return true;
} catch (Exception e) {
Log.error("Failed to read settings", e);
fileHandle.delete();
return false;
}
}
示例6: write
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
public static boolean write() {
FileHandle fileHandle = Compatibility.get().getBaseFolder().child("settings.json");
JsonObject json = new JsonObject();
for (Map.Entry<String, Setting> entry : settings.entrySet()) {
json.set(entry.getKey(), entry.getValue().toJson());
}
try {
Writer writer = fileHandle.writer(false);
json.writeTo(writer, WriterConfig.PRETTY_PRINT);
writer.close();
} catch (Exception e) {
Log.error("Failed to write settings", e);
fileHandle.delete();
return false;
}
return true;
}
示例7: dispose
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
@Override
public void dispose() {
batch.dispose();
originTexture.dispose();
originTextureByDecryptor.dispose();
decryptedTexture.dispose();
FileHandle fileHandle = new FileHandle(encryptedFilePath);
fileHandle.delete();
}
示例8: deleteSave
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
private void deleteSave() {
final FileHandle handle = Gdx.files.local(SAVE_DAT_FILENAME);
if (handle.exists())
handle.delete();
}
示例9: deleteFile
import com.badlogic.gdx.files.FileHandle; //導入方法依賴的package包/類
public boolean deleteFile(String fileName) {
final FileHandle fh = Gdx.files.external(basePath != null ? basePath + fileName : fileName);
return fh.exists() && fh.delete();
}