public static void copyFile(String source, String target) throws IOException { File from = new File(source); if (!from.exists()) { return; } if (from.isFile()) { copyFile(from, new File(target)); } else { copyDir(source, target); } }
public static void copyDir(String sourcePath, String targetPath) throws IOException { File from = new File(sourcePath); if (!from.exists()) { return; } File to = new File(targetPath); if (!to.exists()) { boolean mkdirs = to.mkdirs(); if (!mkdirs) { return; } } String[] child = from.list(); for (String file : child) { File childSource = new File(sourcePath, file); if (childSource.isDirectory()) { copyDir(sourcePath + File.separator + file, targetPath + File.separator + file); } else { copyFile(childSource, new File(targetPath, file)); } } }
private void save() { File uidFile = VEnvironment.getUidListFile(); File bakUidFile = VEnvironment.getBakUidListFile(); if (uidFile.exists()) { if (bakUidFile.exists() && !bakUidFile.delete()) { VLog.w(TAG, "Warning: Unable to delete the expired file --\n " + bakUidFile.getPath()); } try { FileUtils.copyFile(uidFile, bakUidFile); } catch (IOException e) { e.printStackTrace(); } } try { ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream(uidFile)); os.writeInt(mFreeUid); os.writeObject(mSharedUserIdMap); os.close(); } catch (IOException e) { e.printStackTrace(); } }
FileUtils.copyFile(packageFile, privatePackageFile); } catch (IOException e) { privatePackageFile.delete();
public static void copyFile(String source, String target) throws IOException { File from = new File(source); if (!from.exists()) { return; } if (from.isFile()) { copyFile(from, new File(target)); } else { copyDir(source, target); } }
public static void copyDir(String sourcePath, String targetPath) throws IOException { File from = new File(sourcePath); if (!from.exists()) { return; } File to = new File(targetPath); if (!to.exists()) { boolean mkdirs = to.mkdirs(); if (!mkdirs) { return; } } String[] child = from.list(); for (String file : child) { File childSource = new File(sourcePath, file); if (childSource.isDirectory()) { copyDir(sourcePath + File.separator + file, targetPath + File.separator + file); } else { copyFile(childSource, new File(targetPath, file)); } } }
private void save() { File uidFile = VEnvironment.getUidListFile(); File bakUidFile = VEnvironment.getBakUidListFile(); if (uidFile.exists()) { if (bakUidFile.exists() && !bakUidFile.delete()) { VLog.w(TAG, "Warning: Unable to delete the expired file --\n " + bakUidFile.getPath()); } try { FileUtils.copyFile(uidFile, bakUidFile); } catch (IOException e) { e.printStackTrace(); } } try { ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream(uidFile)); os.writeInt(mFreeUid); os.writeObject(mSharedUserIdMap); os.close(); } catch (IOException e) { e.printStackTrace(); } }
private void save() { File uidFile = VEnvironment.getUidListFile(); File bakUidFile = VEnvironment.getBakUidListFile(); if (uidFile.exists()) { if (bakUidFile.exists() && !bakUidFile.delete()) { VLog.w(TAG, "Warning: Unable to delete the expired file --\n " + bakUidFile.getPath()); } try { FileUtils.copyFile(uidFile, bakUidFile); } catch (IOException e) { e.printStackTrace(); } } try { ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream(uidFile)); os.writeInt(mFreeUid); os.writeObject(mSharedUserIdMap); os.close(); } catch (IOException e) { e.printStackTrace(); } }
FileUtils.copyFile(packageFile, privatePackageFile); } catch (IOException e) { privatePackageFile.delete();
FileUtils.copyFile(packageFile, privatePackageFile); } catch (IOException e) { privatePackageFile.delete();