screenshot plugin: create screenshot folder on startup

Fixes attempting to view the screenshots before having taken any. #1506
This commit is contained in:
Adam
2018-04-17 08:20:39 -04:00
parent 686e95c067
commit e94c453d4a

View File

@@ -68,6 +68,7 @@ import net.runelite.api.widgets.WidgetInfo;
import static net.runelite.api.widgets.WidgetInfo.TO_GROUP; import static net.runelite.api.widgets.WidgetInfo.TO_GROUP;
import net.runelite.client.Notifier; import net.runelite.client.Notifier;
import net.runelite.client.RuneLite; import net.runelite.client.RuneLite;
import static net.runelite.client.RuneLite.SCREENSHOT_DIR;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -143,6 +144,8 @@ public class ScreenshotPlugin extends Plugin
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
SCREENSHOT_DIR.mkdirs();
try try
{ {
BufferedImage iconImage; BufferedImage iconImage;
@@ -163,7 +166,7 @@ public class ScreenshotPlugin extends Plugin
{ {
try try
{ {
Desktop.getDesktop().open(RuneLite.SCREENSHOT_DIR); Desktop.getDesktop().open(SCREENSHOT_DIR);
} }
catch (IOException ex) catch (IOException ex)
{ {
@@ -442,11 +445,11 @@ public class ScreenshotPlugin extends Plugin
File playerFolder; File playerFolder;
if (client.getLocalPlayer() != null) if (client.getLocalPlayer() != null)
{ {
playerFolder = new File(RuneLite.SCREENSHOT_DIR, client.getLocalPlayer().getName()); playerFolder = new File(SCREENSHOT_DIR, client.getLocalPlayer().getName());
} }
else else
{ {
playerFolder = RuneLite.SCREENSHOT_DIR; playerFolder = SCREENSHOT_DIR;
} }
playerFolder.mkdirs(); playerFolder.mkdirs();