mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-09 23:36:51 +02:00
check if the directory to store things is writable
This commit is contained in:
@@ -509,7 +509,7 @@ public class Utils {
|
|||||||
* @param path - original path entered to be ripped
|
* @param path - original path entered to be ripped
|
||||||
* @return path of existing folder or the original path if not present
|
* @return path of existing folder or the original path if not present
|
||||||
*/
|
*/
|
||||||
public static String getOriginalDirectory(String path) {
|
public static String getOriginalDirectory(String path) throws IOException {
|
||||||
|
|
||||||
int index;
|
int index;
|
||||||
if (isUnix() || isMacOS()) {
|
if (isUnix() || isMacOS()) {
|
||||||
@@ -524,6 +524,9 @@ public class Utils {
|
|||||||
// Get a List of all Directories and check its lowercase
|
// Get a List of all Directories and check its lowercase
|
||||||
// if file exists return it
|
// if file exists return it
|
||||||
File file = new File(path.substring(0, index));
|
File file = new File(path.substring(0, index));
|
||||||
|
if (! (file.isDirectory() && file.canWrite() && file.canExecute())) {
|
||||||
|
throw new IOException("Original directory \"" + file + "\" is no directory or not writeable.");
|
||||||
|
}
|
||||||
ArrayList<String> names = new ArrayList<>(Arrays.asList(file.list()));
|
ArrayList<String> names = new ArrayList<>(Arrays.asList(file.list()));
|
||||||
|
|
||||||
for (String name : names) {
|
for (String name : names) {
|
||||||
|
Reference in New Issue
Block a user