fist issue

This commit is contained in:
creo 2026-05-24 20:24:18 +03:00
parent 726c4ab942
commit 7ad7631cd2
5 changed files with 110 additions and 12 deletions

6
.classpath Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

17
.gitignore vendored
View File

@ -1,16 +1,11 @@
# ---> Java # Java
# Compiled class file target/
bin/
*.class *.class
# Log file # Log file
*.log *.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files # # Package Files #
*.jar *.jar
*.war *.war
@ -20,7 +15,5 @@
*.tar.gz *.tar.gz
*.rar *.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml # do NOT ignores
hs_err_pid* !lib/*
replay_pid*

17
.project Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>desktopCleanLibraryFilesFromCreo</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -0,0 +1,71 @@
package se.mmk.app;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class LibraryFileCleaner {
String newDirectory;
String currentWd;
public static void main(String[] args) {
new LibraryFileCleaner().run();
}
public void run() {
try {
currentWd = Paths.get(".").toAbsolutePath().normalize().toString();
List<String> libFileNames = getLibraryFileNames();
removeFiles(libFileNames);
}
catch (Exception e) {
//...
}
}
private List<String> getLibraryFileNames() throws IOException{
List<String> fileNames = new ArrayList<>();
FileReader fReader = new FileReader(new File("C:\\Creo_Export\\Creo6-Setting\\Others\\LibraryFiles.txt"));
BufferedReader bReader = new BufferedReader(fReader);
String line = bReader.readLine();
while (!line.isEmpty()) {
String fName = line.toString().substring(line.toString().lastIndexOf('\\'));
if(fName.length() < 2)
continue;
fileNames.add(fName.substring(2));
line = bReader.readLine();
if(line == null)
break;
}
bReader.close();
return fileNames;
}
private void removeFiles(List<String> libFileNames) {
File wdPath = new File(currentWd);
Arrays.asList(wdPath.listFiles()).forEach(f->{
if(f.isFile()) {
for (String fName : libFileNames) {
if(f.getName().contains(fName)) {
f.delete();
}
}
}
});
}
}