no message
This commit is contained in:
@@ -4,7 +4,6 @@ import Common.Utils.Index;
|
||||
import Common.Utils.StringTemplate;
|
||||
import Common.Utils.TextLog;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.GlobalData.GlobalDatabase;
|
||||
import Common.Visual.Windows.Dialog.VFileChooser_;
|
||||
import _VisualDVM.GlobalData.Settings.SettingName;
|
||||
import _VisualDVM.GlobalData.Tasks.TaskState;
|
||||
@@ -39,34 +38,6 @@ public class Utils {
|
||||
public static String MFVar(Object o) {
|
||||
return "$(" + o.toString() + ")";
|
||||
}
|
||||
public static void CheckDirectory(File dir) {
|
||||
if (!dir.exists()) {
|
||||
try {
|
||||
FileUtils.forceMkdir(dir);
|
||||
} catch (Exception e) {
|
||||
Utils_.MainLog.PrintException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void CheckAndCleanDirectory(File dir) {
|
||||
if (dir.exists()) {
|
||||
File[] files = dir.listFiles();
|
||||
if (files != null)
|
||||
for (File f : files) {
|
||||
try {
|
||||
forceDeleteWithCheck(f);
|
||||
} catch (Exception e) {
|
||||
Utils_.MainLog.PrintException(e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
FileUtils.forceMkdir(dir);
|
||||
} catch (Exception e) {
|
||||
Utils_.MainLog.PrintException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static String ReadAllText(File file) {
|
||||
try {
|
||||
return new String(Files.readAllBytes(file.toPath()));
|
||||
@@ -81,7 +52,7 @@ public class Utils {
|
||||
if (files != null) {
|
||||
for (File f : files) {
|
||||
try {
|
||||
forceDeleteWithCheck(f);
|
||||
Utils_.forceDeleteWithCheck(f);
|
||||
} catch (Exception e) {
|
||||
Utils_.MainLog.PrintException(e);
|
||||
}
|
||||
@@ -194,24 +165,6 @@ public class Utils {
|
||||
//нужно проверить корень на наличие хоть одной программы.
|
||||
return Log.isEmpty();
|
||||
}
|
||||
public static void delete_with_check(File file) throws Exception {
|
||||
int attempts = 0;
|
||||
while (attempts < 10) {
|
||||
if (file.exists()) {
|
||||
try {
|
||||
FileUtils.forceDelete(file);
|
||||
} catch (Exception ex) {
|
||||
// ex.printStackTrace();
|
||||
}
|
||||
} else return;
|
||||
if (file.exists()) {
|
||||
attempts++;
|
||||
System.out.println("файл " + Utils_.Brackets(file.getAbsolutePath()) + " занят");
|
||||
Thread.sleep(2000);
|
||||
} else return;
|
||||
}
|
||||
throw new PassException("Не удалось удалить файл " + Utils_.Brackets(file.getAbsolutePath()) + " за " + attempts + " попыток");
|
||||
}
|
||||
public static void GetVertices(float R, float r, float x0, float y0, int n, float phi) {
|
||||
boolean inner = false;
|
||||
for (int i = 0; i < 2 * n; i++) {
|
||||
@@ -253,23 +206,6 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void forceDeleteWithCheck(File file) throws Exception {
|
||||
int attempts = 0;
|
||||
while (attempts < 10) {
|
||||
if (file.exists()) {
|
||||
try {
|
||||
FileUtils.forceDelete(file);
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
} else return;
|
||||
if (file.exists()) {
|
||||
attempts++;
|
||||
Utils_.MainLog.Print("неудачная попытка удаления: файл " + Utils_.Brackets(file.getAbsolutePath()) + " занят");
|
||||
Thread.sleep(2000);
|
||||
} else return;
|
||||
}
|
||||
throw new PassException("Не удалось удалить файл " + Utils_.Brackets(file.getAbsolutePath()) + " за " + attempts + " попыток");
|
||||
}
|
||||
public static Socket createClientSocket(InetAddress address, int port, int timeout) throws Exception {
|
||||
Socket socket = new Socket();
|
||||
socket.setSoTimeout(timeout);
|
||||
@@ -303,7 +239,7 @@ public class Utils {
|
||||
Vector<File> res = new Vector<>();
|
||||
Utils.getFilesByExtensions_r(dir, res, extensions);
|
||||
for (File src : res)
|
||||
Utils.forceDeleteWithCheck(src);
|
||||
Utils_.forceDeleteWithCheck(src);
|
||||
}
|
||||
//----->>
|
||||
//--процессы-------------------------------------------------->>>>>
|
||||
|
||||
Reference in New Issue
Block a user