From 0bb2132bf9b51c50bd892ba6de6d89e95c7a36eb Mon Sep 17 00:00:00 2001
From: ulrich
Date: Wed, 13 Nov 2024 17:58:49 +0000
Subject: [PATCH] Dokumentation in Arbeit

---
 src/de/uhilger/fm/Renamer.java |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/de/uhilger/fm/Renamer.java b/src/de/uhilger/fm/Renamer.java
index 75db53b..856ed88 100644
--- a/src/de/uhilger/fm/Renamer.java
+++ b/src/de/uhilger/fm/Renamer.java
@@ -33,12 +33,12 @@
   
   public static final String STR_DOT = ".";
   
-  public String umbenennen(HttpExchange exchange, String relPfad, String neuerName, File file) throws IOException {
+  public String umbenennen(HttpExchange exchange, String relPfad, String neuerName, File file) 
+          throws IOException {
     File neueDatei;
-    //String relPfad = helper.getFileName(exchange);
-    //File file = new File(exchange.getHttpContext().getAttributes().get(FileHandler.ATTR_FILE_BASE).toString(), relPfad);
     String fname = file.getName().toLowerCase();
-    if(fname.endsWith(Const.JPEG) || fname.endsWith(Const.JPG) || fname.endsWith(Const.PNG)) {
+    if(fname.endsWith(ImageFileFilter.JPEG) || fname.endsWith(ImageFileFilter.JPG) || 
+            fname.endsWith(ImageFileFilter.PNG)) {
       neueDatei = renameImgFiles(file.getParentFile(), file, neuerName);  
     } else {
       neueDatei = new File(file.getParentFile(), neuerName);
@@ -63,21 +63,21 @@
     String ext = fnameext.substring(dotpos);
     //logger.fine("fname: " + fname + ", ext: " + ext);
     
-    DirectoryStream<Path> stream = Files.newDirectoryStream(targetDir.toPath(), fname + "*" + ext); //"*.{txt,doc,pdf,ppt}"
+    DirectoryStream<Path> stream = Files.newDirectoryStream(targetDir.toPath(), fname + "*" + ext); 
     for (Path path : stream) {
       //logger.fine(path.getFileName().toString());
       alt = path.getFileName().toString();
       //logger.fine("alt: " + alt);
-      if(alt.contains(Const.TN)) {
-        neu = newfname + Const.TN + newext;
-      } else if (alt.contains(Const.KL)) {
-        neu = newfname + Const.KL + newext;
-      } else if(alt.contains(Const.GR)) {
-        neu = newfname + Const.GR + newext;
-      } else if(alt.contains(Const.MT)) {
-        neu = newfname + Const.MT + newext;
-      } else if(alt.contains(Const.SM)) {
-        neu = newfname + Const.SM + newext;
+      if(alt.contains(ImageFileFilter.TN)) {
+        neu = newfname + ImageFileFilter.TN + newext;
+      } else if (alt.contains(ImageFileFilter.KL)) {
+        neu = newfname + ImageFileFilter.KL + newext;
+      } else if(alt.contains(ImageFileFilter.GR)) {
+        neu = newfname + ImageFileFilter.GR + newext;
+      } else if(alt.contains(ImageFileFilter.MT)) {
+        neu = newfname + ImageFileFilter.MT + newext;
+      } else if(alt.contains(ImageFileFilter.SM)) {
+        neu = newfname + ImageFileFilter.SM + newext;
       } else {
         neu = newName;
       }

--
Gitblit v1.9.3