mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-08 11:43:28 +00:00
#737 Exporting Scripts to single file
This commit is contained in:
@@ -1,21 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.helpers;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -26,15 +28,21 @@ public class Path {
|
||||
public static String combine(String... paths) {
|
||||
String result = "";
|
||||
String separator = File.separator;
|
||||
String separator = File.separator;
|
||||
for (String path : paths) {
|
||||
if (path.startsWith(separator)) {
|
||||
result = result.substring(separator.length());
|
||||
}
|
||||
if (!result.endsWith(separator)) {
|
||||
for (int i = 0; i < paths.length; i++) {
|
||||
String path = paths[i];
|
||||
if (i > 0) {
|
||||
if (path.startsWith(separator)) {
|
||||
path = path.substring(separator.length());
|
||||
}
|
||||
|
||||
if (!result.endsWith(separator)) {
|
||||
result += separator;
|
||||
}
|
||||
}
|
||||
|
||||
result += path;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -69,4 +77,14 @@ public class Path {
|
||||
}
|
||||
return ext;
|
||||
}
|
||||
|
||||
public static void createDirectorySafe(File directory) throws IOException {
|
||||
if (!directory.exists()) {
|
||||
if (!directory.mkdirs()) {
|
||||
if (!directory.exists()) {
|
||||
throw new IOException("Cannot create directory " + directory);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user