Skip to content

Commit

Permalink
Added debugging information for when no snapshots could be found.
Browse files Browse the repository at this point in the history
  • Loading branch information
sk89q committed Jan 30, 2011
1 parent d928035 commit ec9c988
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions src/com/sk89q/worldedit/commands/SnapshotCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@

package com.sk89q.worldedit.commands;

import java.io.File;
import java.io.IOException;
import java.util.logging.Logger;
import com.sk89q.util.commands.Command;
import com.sk89q.util.commands.CommandContext;
import com.sk89q.worldedit.*;
Expand All @@ -36,6 +38,8 @@
* @author sk89q
*/
public class SnapshotCommands {
private static Logger logger = Logger.getLogger("Minecraft.WorldEdit");

@Command(
aliases = {"listsnapshots"},
usage = "[num]",
Expand Down Expand Up @@ -63,7 +67,19 @@ public static void list(CommandContext args, WorldEdit we,

player.print("Use //use [snapshot] or //use latest to set the snapshot.");
} else {
player.printError("No snapshots are available.");
player.printError("No snapshots are available. See console for details.");

// Okay, let's toss some debugging information!
File dir = config.snapshotRepo.getDirectory();

try {
logger.info("WorldEdit found no snapshots: looked in: " +
dir.getCanonicalPath());
} catch (IOException e) {
logger.info("WorldEdit found no snapshots: looked in "
+ "(NON-RESOLVABLE PATH - does it exist?): " +
dir.getPath());
}
}
} else {
player.printError("Snapshot/backup restore is not configured.");
Expand Down Expand Up @@ -151,7 +167,20 @@ public static void restore(CommandContext args, WorldEdit we,
snapshot = config.snapshotRepo.getDefaultSnapshot();

if (snapshot == null) {
player.printError("No snapshots were found.");
player.printError("No snapshots were found. See console for details.");

// Okay, let's toss some debugging information!
File dir = config.snapshotRepo.getDirectory();

try {
logger.info("WorldEdit found no snapshots: looked in: " +
dir.getCanonicalPath());
} catch (IOException e) {
logger.info("WorldEdit found no snapshots: looked in "
+ "(NON-RESOLVABLE PATH - does it exist?): " +
dir.getPath());
}

return;
}
}
Expand Down

0 comments on commit ec9c988

Please sign in to comment.