当前位置: 首页>>代码示例>>Java>>正文


Java FileHandle.mkdirs方法代码示例

本文整理汇总了Java中com.badlogic.gdx.files.FileHandle.mkdirs方法的典型用法代码示例。如果您正苦于以下问题:Java FileHandle.mkdirs方法的具体用法?Java FileHandle.mkdirs怎么用?Java FileHandle.mkdirs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.files.FileHandle的用法示例。


在下文中一共展示了FileHandle.mkdirs方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertToDex

import com.badlogic.gdx.files.FileHandle; //导入方法依赖的package包/类
private FileHandle convertToDex(FileHandle fileHandle) throws Exception {
  String inputHash = hashFile(fileHandle);
  
  FileHandle cacheDir = new FileHandle(androidCompatibility.androidLauncher.getCacheDir());
  FileHandle dexDir = cacheDir.child("converted_mod_dex");
  dexDir.mkdirs();
  FileHandle dexFile = dexDir.child(inputHash + ".dex");
  
  if (!dexFile.exists()) {
    Log.warning("Trying to convert jar to dex: " + fileHandle.file().getAbsolutePath());
    com.android.dx.command.dexer.Main.Arguments arguments = new com.android.dx.command.dexer.Main.Arguments();
    arguments.parse(new String[]{"--output=" + dexFile.file().getAbsolutePath(), fileHandle.file().getAbsolutePath()});
    int result = com.android.dx.command.dexer.Main.run(arguments);
    if (result != 0) throw new CubesException("Failed to convert jar to dex [" + result + "]: " + fileHandle.file().getAbsolutePath());
    Log.warning("Converted jar to dex: " + fileHandle.file().getAbsolutePath());
  }
  
  return dexFile;
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:20,代码来源:AndroidModLoader.java

示例2: createSave

import com.badlogic.gdx.files.FileHandle; //导入方法依赖的package包/类
public static Save createSave(String name, String generatorID, Gamemode gamemode, String seedString) {
  if (name != null) name = name.trim();
  if (name == null || name.isEmpty()) name = "world-" + Integer.toHexString(MathUtils.random.nextInt());
  FileHandle folder = getSavesFolder();
  FileHandle handle = folder.child(name);
  handle.mkdirs();
  Compatibility.get().nomedia(handle);
  Save s = new Save(name, handle);

  SaveOptions options = new SaveOptions();
  options.setWorldSeed(seedString);
  options.worldType = generatorID;
  options.worldGamemode = gamemode;
  s.setSaveOptions(options);

  return s;
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:18,代码来源:ClientSaveManager.java

示例3: takeScreenshot

import com.badlogic.gdx.files.FileHandle; //导入方法依赖的package包/类
public static void takeScreenshot() {
	Pixmap pixmap = ScreenUtils.getFrameBufferPixmap(0, 0, Gdx.graphics.getBackBufferWidth(),
			Gdx.graphics.getBackBufferHeight());
	FileHandle dir = Compatibility.get().getBaseFolder().child("screenshots");
	dir.mkdirs();
	FileHandle f = dir.child(System.currentTimeMillis() + ".png");
	try {
		PixmapIO.PNG writer = new PixmapIO.PNG((int) (pixmap.getWidth() * pixmap.getHeight() * 1.5f));
		try {
			writer.setFlipY(true);
			writer.write(f, pixmap);
		} finally {
			writer.dispose();
		}
	} catch (IOException ex) {
		throw new CubesException("Error writing PNG: " + f, ex);
	} finally {
		pixmap.dispose();
	}
	Log.info("Took screenshot '" + f.file().getAbsolutePath() + "'");
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:22,代码来源:Graphics.java

示例4: toggleTracking

import com.badlogic.gdx.files.FileHandle; //导入方法依赖的package包/类
public static void toggleTracking() {
	synchronized (enabled) {
		if (enabled.get()) {
			stopTracking();
			FileHandle dir = Compatibility.get().getBaseFolder().child("performance");
			Compatibility.get().nomedia(dir);
			dir.mkdirs();
			try {
				save(dir.child(System.currentTimeMillis() + ".cbpf").file());
			} catch (IOException e) {
				Debug.crash(e);
			}
		} else {
			clear();
			startTracking();
		}
	}
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:19,代码来源:Performance.java

示例5: takeScreenshot

import com.badlogic.gdx.files.FileHandle; //导入方法依赖的package包/类
public static void takeScreenshot() {
  Pixmap pixmap = ScreenUtils.getFrameBufferPixmap(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight());
  FileHandle dir = Compatibility.get().getBaseFolder().child("screenshots");
  dir.mkdirs();
  FileHandle f = dir.child(System.currentTimeMillis() + ".png");
  try {
    PixmapIO.PNG writer = new PixmapIO.PNG((int) (pixmap.getWidth() * pixmap.getHeight() * 1.5f));
    try {
      writer.setFlipY(true);
      writer.write(f, pixmap);
    } finally {
      writer.dispose();
    }
  } catch (IOException ex) {
    throw new CubesException("Error writing PNG: " + f, ex);
  } finally {
    pixmap.dispose();
  }
  Log.info("Took screenshot '" + f.file().getAbsolutePath() + "'");
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:21,代码来源:Graphics.java

示例6: toggleTracking

import com.badlogic.gdx.files.FileHandle; //导入方法依赖的package包/类
public static synchronized void toggleTracking() {
  if (enabled.get()) {
    stopTracking();
    FileHandle dir = Compatibility.get().getBaseFolder().child("performance");
    Compatibility.get().nomedia(dir);
    dir.mkdirs();
    try {
      save(dir.child(System.currentTimeMillis() + ".cbpf").file());
    } catch (IOException e) {
      Debug.crash(e);
    }
  } else {
    clear();
    startTracking();
  }
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:17,代码来源:Performance.java

示例7: file

import com.badlogic.gdx.files.FileHandle; //导入方法依赖的package包/类
public static FileHandle file(Save save, int x, int z) {
	FileHandle folderArea = save.folderArea();
	FileHandle xMostSignificant = folderArea.child(Integer.toString(x & 0xFFFF0000));
	FileHandle xLeastSignificant = xMostSignificant.child(Integer.toString(x & 0xFFFF));
	FileHandle zMostSignificant = xLeastSignificant.child(Integer.toString(z & 0xFFFF0000));
	zMostSignificant.mkdirs();
	Compatibility.get().nomedia(zMostSignificant);

	return zMostSignificant.child(Integer.toString(z & 0xFFFF));
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:11,代码来源:SaveAreaIO.java

示例8: getPackedTextureSheet

import com.badlogic.gdx.files.FileHandle; //导入方法依赖的package包/类
private static PackedTextureSheet getPackedTextureSheet(AssetType... assetType) {
	if (Adapter.isDedicatedServer())
		return null;
	TexturePacker texturePacker = new TexturePacker(2048, 2048, 1, true);
	Pixmap pixmap;
	getPacketTextureSheetFor(assetType, texturePacker, pixmap);

	FileHandle fileHandle = assetsFolder.child("packed");
	fileHandle.mkdirs();
	Compatibility.get().nomedia(fileHandle);
	fileHandle = fileHandle.child(assetType[0].name() + ".cim");

	try {
		PixmapIO.writeCIM(fileHandle, texturePacker.getPixmap());
	} catch (GdxRuntimeException e) {
		Log.error("Failed to write packed image", e);
	}

	Texture texture = new Texture(fileHandle);
	texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
	PackedTextureSheet packedTextureSheet = new PackedTextureSheet(
			new Material(TextureAttribute.createDiffuse(texture)));
	packedTextureSheet.getMaterial().set(new BlendingAttribute(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA));

	Map<Asset, TexturePacker.PackRectangle> rectangles = texturePacker.getRectangles();
	int num = 0;
	for (Map.Entry<Asset, TexturePacker.PackRectangle> entry : rectangles.entrySet()) {
		num++;
		TextureRegion textureRegion = new TextureRegion(texture, entry.getValue().x, entry.getValue().y,
				entry.getValue().width, entry.getValue().height);
		entry.getKey().setPackedTextureRegion(textureRegion, packedTextureSheet);
		packedTextureSheet.getPackedTextures().put(entry.getKey().toString(), textureRegion);
	}

	for (AssetType type : assetType) {
		type.setPackedTextureSheet(packedTextureSheet);
	}
	return packedTextureSheet;
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:40,代码来源:Assets.java

示例9: getModFiles

import com.badlogic.gdx.files.FileHandle; //导入方法依赖的package包/类
private static List<FileHandle> getModFiles() {
	FileHandle base = Compatibility.get().getBaseFolder().child("mods");
	base.mkdirs();
	Compatibility.get().nomedia(base);
	ArrayList<FileHandle> fileHandles = new ArrayList<FileHandle>();
	fileHandles.addAll(modManager.extraMods);
	Collections.addAll(fileHandles, base.list(new FileFilter() {
		@Override
		public boolean accept(File pathname) {
			String s = pathname.getName().toLowerCase();
			return s.endsWith(".cm");
		}
	}));
	return fileHandles;
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:16,代码来源:ModManager.java

示例10: file

import com.badlogic.gdx.files.FileHandle; //导入方法依赖的package包/类
public static FileHandle file(Save save, int x, int z) {
  FileHandle folderArea = save.folderArea();
  FileHandle xMostSignificant = folderArea.child(Integer.toString(x & 0xFFFF0000));
  FileHandle xLeastSignificant = xMostSignificant.child(Integer.toString(x & 0xFFFF));
  FileHandle zMostSignificant = xLeastSignificant.child(Integer.toString(z & 0xFFFF0000));
  zMostSignificant.mkdirs();
  Compatibility.get().nomedia(zMostSignificant);
  
  return zMostSignificant.child(Integer.toString(z & 0xFFFF));
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:11,代码来源:SaveAreaIO.java

示例11: getModFiles

import com.badlogic.gdx.files.FileHandle; //导入方法依赖的package包/类
private static List<FileHandle> getModFiles() {
  FileHandle base = Compatibility.get().getBaseFolder().child("mods");
  base.mkdirs();
  Compatibility.get().nomedia(base);
  ArrayList<FileHandle> fileHandles = new ArrayList<FileHandle>();
  fileHandles.addAll(extraMods);
  Collections.addAll(fileHandles, base.list(new FileFilter() {
    @Override
    public boolean accept(File pathname) {
      String s = pathname.getName().toLowerCase();
      return s.endsWith(".cm");
    }
  }));
  return fileHandles;
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:16,代码来源:ModManager.java

示例12: generate

import com.badlogic.gdx.files.FileHandle; //导入方法依赖的package包/类
protected static void generate(FileHandle folder) {
	folder.mkdirs();
	for (Strength strength : Strength.values()) {
		generate(folder.child(strength.name() + ".png"), strength.strength);
	}
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:7,代码来源:AOTextureGenerator.java

示例13: generate

import com.badlogic.gdx.files.FileHandle; //导入方法依赖的package包/类
protected static void generate(FileHandle folder) {
  folder.mkdirs();
  for (Strength strength : Strength.values()) {
    generate(folder.child(strength.name() + ".png"), strength.strength);
  }
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:7,代码来源:AOTextureGenerator.java


注:本文中的com.badlogic.gdx.files.FileHandle.mkdirs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。