Show errors if any directories could not be created. (fixes #97)
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
parent
05c7ac0a02
commit
4e2074e41b
|
@ -140,8 +140,8 @@ public class Options {
|
||||||
rootPath = String.format("%s/%s", home, fallback);
|
rootPath = String.format("%s/%s", home, fallback);
|
||||||
}
|
}
|
||||||
File dir = new File(rootPath, "opsu");
|
File dir = new File(rootPath, "opsu");
|
||||||
if (!dir.isDirectory())
|
if (!dir.isDirectory() && !dir.mkdir())
|
||||||
dir.mkdir();
|
ErrorHandler.error(String.format("Failed to create configuration folder at '%s/opsu'.", rootPath), null, false);
|
||||||
return dir;
|
return dir;
|
||||||
} else
|
} else
|
||||||
return new File("./");
|
return new File("./");
|
||||||
|
@ -357,7 +357,7 @@ public class Options {
|
||||||
public String getValueString() { return String.format("%dms", val); }
|
public String getValueString() { return String.format("%dms", val); }
|
||||||
},
|
},
|
||||||
DISABLE_SOUNDS ("Disable All Sound Effects", "DisableSound", "May resolve Linux sound driver issues. Requires a restart.",
|
DISABLE_SOUNDS ("Disable All Sound Effects", "DisableSound", "May resolve Linux sound driver issues. Requires a restart.",
|
||||||
(System.getProperty("os.name").toLowerCase().indexOf("linux") > -1)),
|
(System.getProperty("os.name").toLowerCase().contains("linux"))),
|
||||||
KEY_LEFT ("Left Game Key", "keyOsuLeft", "Select this option to input a key.") {
|
KEY_LEFT ("Left Game Key", "keyOsuLeft", "Select this option to input a key.") {
|
||||||
@Override
|
@Override
|
||||||
public String getValueString() { return Keyboard.getKeyName(getGameKeyLeft()); }
|
public String getValueString() { return Keyboard.getKeyName(getGameKeyLeft()); }
|
||||||
|
@ -1094,7 +1094,10 @@ public class Options {
|
||||||
if (beatmapDir.isDirectory())
|
if (beatmapDir.isDirectory())
|
||||||
return beatmapDir;
|
return beatmapDir;
|
||||||
}
|
}
|
||||||
beatmapDir.mkdir(); // none found, create new directory
|
|
||||||
|
// none found, create new directory
|
||||||
|
if (!beatmapDir.mkdir())
|
||||||
|
ErrorHandler.error(String.format("Failed to create beatmap directory at '%s'.", beatmapDir.getAbsolutePath()), null, false);
|
||||||
return beatmapDir;
|
return beatmapDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1108,7 +1111,8 @@ public class Options {
|
||||||
return oszDir;
|
return oszDir;
|
||||||
|
|
||||||
oszDir = new File(DATA_DIR, "SongPacks/");
|
oszDir = new File(DATA_DIR, "SongPacks/");
|
||||||
oszDir.mkdir();
|
if (!oszDir.isDirectory() && !oszDir.mkdir())
|
||||||
|
ErrorHandler.error(String.format("Failed to create song packs directory at '%s'.", oszDir.getAbsolutePath()), null, false);
|
||||||
return oszDir;
|
return oszDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1122,7 +1126,8 @@ public class Options {
|
||||||
return replayImportDir;
|
return replayImportDir;
|
||||||
|
|
||||||
replayImportDir = new File(DATA_DIR, "ReplayImport/");
|
replayImportDir = new File(DATA_DIR, "ReplayImport/");
|
||||||
replayImportDir.mkdir();
|
if (!replayImportDir.isDirectory() && !replayImportDir.mkdir())
|
||||||
|
ErrorHandler.error(String.format("Failed to create replay import directory at '%s'.", replayImportDir.getAbsolutePath()), null, false);
|
||||||
return replayImportDir;
|
return replayImportDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1167,7 +1172,10 @@ public class Options {
|
||||||
if (skinRootDir.isDirectory())
|
if (skinRootDir.isDirectory())
|
||||||
return skinRootDir;
|
return skinRootDir;
|
||||||
}
|
}
|
||||||
skinRootDir.mkdir(); // none found, create new directory
|
|
||||||
|
// none found, create new directory
|
||||||
|
if (!skinRootDir.mkdir())
|
||||||
|
ErrorHandler.error(String.format("Failed to create skins directory at '%s'.", skinRootDir.getAbsolutePath()), null, false);
|
||||||
return skinRootDir;
|
return skinRootDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -289,12 +289,10 @@ public class Utils {
|
||||||
public static void takeScreenShot() {
|
public static void takeScreenShot() {
|
||||||
// create the screenshot directory
|
// create the screenshot directory
|
||||||
File dir = Options.getScreenshotDir();
|
File dir = Options.getScreenshotDir();
|
||||||
if (!dir.isDirectory()) {
|
if (!dir.isDirectory() && !dir.mkdir()) {
|
||||||
if (!dir.mkdir()) {
|
ErrorHandler.error(String.format("Failed to create screenshot directory at '%s'.", dir.getAbsolutePath()), null, false);
|
||||||
ErrorHandler.error("Failed to create screenshot directory.", null, false);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// create file name
|
// create file name
|
||||||
SimpleDateFormat date = new SimpleDateFormat("yyyyMMdd_HHmmss");
|
SimpleDateFormat date = new SimpleDateFormat("yyyyMMdd_HHmmss");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user