From 8bde6f998b7112a15624e24e2ee070ebf24a9172 Mon Sep 17 00:00:00 2001
From: ulrich
Date: Thu, 14 Nov 2024 08:58:10 +0000
Subject: [PATCH] Dokumentation in Arbeit

---
 src/de/uhilger/fm/Renamer.java |   33 ++++++++++++++++-----------------
 1 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/src/de/uhilger/fm/Renamer.java b/src/de/uhilger/fm/Renamer.java
index d85facc..83a1e87 100644
--- a/src/de/uhilger/fm/Renamer.java
+++ b/src/de/uhilger/fm/Renamer.java
@@ -1,5 +1,5 @@
 /*
-  neon-fm - File management extensions to Neon
+  fm - File management class library
   Copyright (C) 2024  Ulrich Hilger
 
   This program is free software: you can redistribute it and/or modify
@@ -17,7 +17,6 @@
  */
 package de.uhilger.fm;
 
-import com.sun.net.httpserver.HttpExchange;
 import java.io.File;
 import java.io.IOException;
 import java.nio.file.DirectoryStream;
@@ -33,12 +32,12 @@
   
   public static final String STR_DOT = ".";
   
-  public String umbenennen(HttpExchange exchange, String relPfad, String neuerName, File file) throws IOException {
+  public String rename(/*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 +62,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