From f29f297beb2fe32b4bb574c802dace2364483d78 Mon Sep 17 00:00:00 2001 From: ulrich Date: Wed, 13 Nov 2024 22:39:54 +0000 Subject: [PATCH] Dokumentation in Arbeit --- src/de/uhilger/fm/Renamer.java | 32 ++++++++++++++++---------------- 1 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/de/uhilger/fm/Renamer.java b/src/de/uhilger/fm/Renamer.java index d85facc..856ed88 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 @@ -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