();
- return this.findWithFull(startPath, mask, FileFinder.FILES);
- }
-
- /**
- *
- * getDirectorySize.
- *
- *
- * @return a long.
- */
- public final long getDirectorySize() {
- return this.totalLength;
- }
-
- /**
- *
- * Getter for the field filesNumber.
- *
- *
- * @return a int.
- */
- public final int getFilesNumber() {
- return this.filesNumber;
- }
-
- /**
- *
- * Getter for the field directoriesNumber.
- *
- *
- * @return a long.
- */
- public final long getDirectoriesNumber() {
- return this.directoriesNumber;
- }
-
- /**
- *
- * accept.
- *
- *
- * @param name
- * a {@link java.lang.String} object.
- * @return a boolean.
- */
- private boolean accept(final String name) {
-
- if (this.p == null) {
- return true;
- }
-
- this.m = this.p.matcher(name);
-
- return this.m.matches();
- }
-
- /**
- *
- * findWithFull.
- *
- *
- * @param startPath
- * a {@link java.lang.String} object.
- * @param mask
- * a {@link java.lang.String} object.
- * @param objectType
- * a int.
- * @return a {@link java.util.List} object.
- * @throws java.lang.Exception
- * if any.
- */
- private List findWithFull(final String startPath, final String mask, final int objectType) throws Exception {
-
- if ((startPath == null) || (mask == null)) {
- throw new Exception("Error");
- }
- final File topDirectory = new File(startPath);
- if (!topDirectory.exists()) {
- throw new Exception("Error");
- }
-
- if (!mask.equals("")) {
- this.p = Pattern.compile(mask, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
- }
- this.filesNumber = 0;
- this.directoriesNumber = 0;
- this.totalLength = 0;
- final ArrayList res = new ArrayList(100);
-
- this.searchWithFull(topDirectory, res, objectType);
- this.p = null;
- return res;
- }
-
- /**
- *
- * searchWithFull.
- *
- *
- * @param topDirectory
- * a {@link java.io.File} object.
- * @param res
- * a {@link java.util.List} object.
- * @param objectType
- * a int.
- */
- private void searchWithFull(final File topDirectory, final List res, final int objectType) {
-
- final File[] list = topDirectory.listFiles();
-
- for (final File element : list) {
-
- if (element.isDirectory()) {
-
- if ((objectType != FileFinder.FILES) && this.accept(element.getName())) {
-
- this.directoriesNumber++;
- res.add(element);
- }
-
- this.searchWithFull(element, res, objectType);
- } else {
-
- if ((objectType != FileFinder.DIRECTORIES) && this.accept(element.getName())) {
- if (element.getName().contains("full")) {
- if (this.fileNames.size() == 0) {
- this.fileNames.add(element.getName());
- this.filesNumber++;
- this.totalLength += element.length();
- res.add(element);
- }
- this.fName.add(element.getName());
- if (this.fileNames.size() >= 1) {
- if (Collections.indexOfSubList(this.fileNames, this.fName) == -1) {
- this.fileNames.add(element.getName());
- this.filesNumber++;
- this.totalLength += element.length();
- res.add(element);
- }
- this.fName.remove(0);
- }
- }
- }
- }
- }
- }
-
-}
diff --git a/src/main/java/forge/view/FView.java b/src/main/java/forge/view/FView.java
index 5869b9bb78b..89ac8085ba1 100644
--- a/src/main/java/forge/view/FView.java
+++ b/src/main/java/forge/view/FView.java
@@ -5,8 +5,11 @@ import java.awt.Color;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Graphics;
+import java.io.File;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import javax.swing.JFrame;
import javax.swing.JLayeredPane;
@@ -16,8 +19,12 @@ import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder;
import net.miginfocom.swing.MigLayout;
+
+import com.google.common.collect.Lists;
+
import forge.Singletons;
import forge.control.FControl;
+import forge.gui.DialogMigrateProfile;
import forge.gui.deckeditor.VDeckEditorUI;
import forge.gui.framework.DragCell;
import forge.gui.framework.EDocID;
@@ -29,6 +36,7 @@ import forge.gui.toolbox.FOverlay;
import forge.gui.toolbox.FPanel;
import forge.gui.toolbox.FSkin;
import forge.model.BuildInfo;
+import forge.properties.NewConstants;
/** */
public enum FView {
@@ -108,7 +116,6 @@ public enum FView {
// All is ready to go - fire up home screen and discard splash frame.
Singletons.getControl().changeState(FControl.Screens.HOME_SCREEN);
- //CMainMenu.SINGLETON_INSTANCE.selectPrevious();
FView.this.frmSplash.dispose();
FView.this.frmSplash = null;
@@ -116,6 +123,35 @@ public enum FView {
// Allow OS to set location. Hopefully this doesn't cause issues
frmDocument.setLocationByPlatform(true);
frmDocument.setVisible(true);
+
+ // remove this once our userbase has been migrated to the profile layout
+ {
+ // get profile directories -- if one of them is actually under the res directory, don't
+ // try to migrate it
+ Set profileDirs = new HashSet();
+ for (String dname : NewConstants.PROFILE_DIRS) {
+ profileDirs.add(new File(dname));
+ }
+
+ // check quickly whether we have any data to migrate
+ boolean hasData = false;
+ for (String resDir : Lists.newArrayList("decks", "gauntlet", "pics", "pics_product", "preferences", "quest/data")) {
+ File f = new File("res", resDir);
+ if (f.exists() && !profileDirs.contains(f)) {
+ System.out.println("pre-profile data found: " + f.getAbsolutePath());
+ hasData = true;
+ break;
+ }
+ }
+
+ if (hasData) {
+ new DialogMigrateProfile("res", true, new Runnable() {
+ @Override public void run() {
+ // TODO: reload appropriate data structures
+ }
+ });
+ }
+ }
}
/** @return {@link forge.view.SplashFrame} */