/*     */ public static void restoreContents(
     File zipSource, File folderDestiny, String genericName) {
   /* 153 */ File genericFolder = new File(MinecraftUtil.getTempFolder(), genericName);
   /* 154 */ if (genericFolder.exists()) {
     /* 155 */ deleteFileDir(genericFolder);
     /*     */ }
   /* 157 */ if (!folderDestiny.exists()) {
     /* 158 */ folderDestiny.mkdirs();
     /*     */ }
   /* 160 */ if (!folderDestiny.isDirectory()) {
     /* 161 */ throw new IllegalArgumentException("The destiny folder must be a directory!");
     /*     */ }
   /* 163 */ Zipper.unzipFolder(zipSource, MinecraftUtil.getTempFolder());
   /* 164 */ if (!genericFolder.exists()) {
     /* 165 */ throw new IllegalStateException(
         "Wrong content in zip file -> not found: " + genericFolder.getName());
     /*     */ }
   /* 167 */ File[] generics = genericFolder.listFiles();
   /* 168 */ for (File generic : generics) {
     /* 169 */ File destiny = new File(folderDestiny, generic.getName());
     /* 170 */ if (destiny.exists()) {
       /* 171 */ deleteFileDir(destiny);
       /*     */ }
     /* 173 */ generic.renameTo(destiny);
     /*     */ }
   /*     */ }
Пример #2
0
 public static void restoreContents(File zipSource, File folderDestiny, String genericName) {
   File genericFolder = new File(MinecraftUtil.getTempFolder(), genericName);
   if (genericFolder.exists()) {
     deleteFileDir(genericFolder);
   }
   if (!folderDestiny.exists()) {
     folderDestiny.mkdirs();
   }
   if (!folderDestiny.isDirectory()) {
     throw new IllegalArgumentException("The destiny folder must be a directory!");
   }
   Zipper.unzipFolder(zipSource, MinecraftUtil.getTempFolder());
   if (!genericFolder.exists()) {
     throw new IllegalStateException(
         "Wrong content in zip file -> not found: " + genericFolder.getName());
   }
   File[] generics = genericFolder.listFiles();
   for (File generic : generics) {
     File destiny = new File(folderDestiny, generic.getName());
     if (destiny.exists()) {
       deleteFileDir(destiny);
     }
     generic.renameTo(destiny);
   }
 }
 /*     */ public static void restoreFile(File zipSource, File destiny, String genericName) {
   /* 122 */ File generic = new File(MinecraftUtil.getTempFolder(), genericName);
   /* 123 */ if (generic.exists()) {
     /* 124 */ deleteFileDir(generic);
     /*     */ }
   /* 126 */ Zipper.unzipFolder(zipSource, MinecraftUtil.getTempFolder());
   /* 127 */ if (!generic.exists()) {
     /* 128 */ throw new IllegalStateException(
         "Wrong content in zip file -> not found: " + generic.getName());
     /*     */ }
   /* 130 */ if (destiny.exists()) {
     /* 131 */ deleteFileDir(destiny);
     /*     */ }
   /* 133 */ if ((destiny.getParentFile() != null) && (!destiny.getParentFile().exists())) {
     /* 134 */ destiny.getParentFile().mkdirs();
     /*     */ }
   /* 136 */ generic.renameTo(destiny);
   /*     */ }
Пример #4
0
 public static void restoreFile(File zipSource, File destiny, String genericName) {
   File generic = new File(MinecraftUtil.getTempFolder(), genericName);
   if (generic.exists()) {
     deleteFileDir(generic);
   }
   Zipper.unzipFolder(zipSource, MinecraftUtil.getTempFolder());
   if (!generic.exists()) {
     throw new IllegalStateException(
         "Wrong content in zip file -> not found: " + generic.getName());
   }
   if (destiny.exists()) {
     deleteFileDir(destiny);
   }
   if ((destiny.getParentFile() != null) && (!destiny.getParentFile().exists())) {
     destiny.getParentFile().mkdirs();
   }
   generic.renameTo(destiny);
 }
Пример #5
0
 public static void backupFile(
     File source, File zipDestiny, String genericName, String extension) {
   File generic = new File(MinecraftUtil.getTempFolder(), genericName);
   if (!source.exists()) {
     throw new IllegalArgumentException("Source file does not exist: " + source.getName());
   }
   if (!zipDestiny.getName().endsWith("." + extension)) {
     zipDestiny = new File(zipDestiny.getPath() + "." + extension);
   }
   if (generic.exists()) {
     deleteFileDir(generic);
   }
   source.renameTo(generic);
   Zipper.zipFolder(generic, zipDestiny);
   generic.renameTo(source);
 }
 /*     */ public static void backupFile(
     File source, File zipDestiny, String genericName, String extension) {
   /*  80 */ File generic = new File(MinecraftUtil.getTempFolder(), genericName);
   /*  81 */ if (!source.exists()) {
     /*  82 */ throw new IllegalArgumentException(
         "Source file does not exist: " + source.getName());
     /*     */ }
   /*  84 */ if (!zipDestiny.getName().endsWith("." + extension)) {
     /*  85 */ zipDestiny = new File(zipDestiny.getPath() + "." + extension);
     /*     */ }
   /*  87 */ if (generic.exists()) {
     /*  88 */ deleteFileDir(generic);
     /*     */ }
   /*  90 */ source.renameTo(generic);
   /*  91 */ Zipper.zipFolder(generic, zipDestiny);
   /*  92 */ generic.renameTo(source);
   /*     */ }