diff --git a/CHANGELOG.md b/CHANGELOG.md
index 89c6baa..ae4c3af 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,17 @@
# Changelog: treeScanner.exe
-- **11-05-25 - v1.0.1** [UNCOMMITET]
+- **2025-05-14 - v1.1.0**
+
+ - **Hinzugefügt:**
+ - [x] Laufzeitmessung per `GetTickCount64()` in `main.c`
+ - [x] Ausgabe der Gesamtzeit in Millisekunden nach Scanabschluss
+ - [x] `scanner_config.h/.c` mit `ScannerConfig`-Struktur für zentrale Parameterverwaltung
+ - [x] CLI-Parameter `--depth` für maximale Verzeichnistiefe (`main.c`)
+ - [x] CLI-Parameter `--limit` für max. Dateien pro Verzeichnis (`main.c`)
+ - [x] Erweiterung von `scan_directory()` zur Einhaltung der Limits (`app.c`)
+ - [x] Neue Funktionssignatur in `app.h`: Übergabe der Konfiguration
+
+- **2025-05-11 - v1.0.1**
- [x] `favicon.ico` erstellt und hinzugefügt
- [X] `desktop.ini` erstellt
- [x] `version.rc`erstellt und `build.cmd`entsprechend angepasst das Metadaten compiliert werden
diff --git a/Makefile b/Makefile
index 6cdb35e..4dcb520 100644
--- a/Makefile
+++ b/Makefile
@@ -1,32 +1,39 @@
-# Haupt-Makefile
+# Makefile – Buildsystem für scanner.exe unter MSVC
+# Aufruf über build.cmd (ruft vcvars64.bat auf) → dann make
+# Zentrale Konfiguration laden
include Makefile.config
-# Wenn DEBUG=1 gesetzt ist: zusätzliche Flags anhängen
-ifeq ($(DEBUG),1)
- CFLAGS = $(BASE_CFLAGS) /Zi /Od /DDEBUG
- LDFLAGS = $(BASE_LDFLAGS) /DEBUG /PDB:$(OUTDIR)\scanner.pdb
-
-else
- CFLAGS = $(BASE_CFLAGS) /O2
- LDFLAGS = $(BASE_LDFLAGS)
-endif
-
+# Standardziel
all: $(EXE)
+# ---- Kompilieren der Quellcodedateien ----
+
+# main.c → main.obj
$(OUTDIR)\main.obj: $(SRCDIR)\main.c
@if not exist $(OUTDIR) mkdir $(OUTDIR)
$(CC) $(CFLAGS) /c /Fo:$@ $<
+# app.c → app.obj
$(OUTDIR)\app.obj: $(SRCDIR)\app.c
$(CC) $(CFLAGS) /c /Fo:$@ $<
+# scanner_config.c → scanner_config.obj
+$(OUTDIR)\scanner_config.obj: $(SRCDIR)\scanner_config.c
+ $(CC) $(CFLAGS) /c /Fo:$@ $<
+
+# Ressourcen-Datei → version.res
$(RES): $(RESDIR)\version.rc
$(RC) /nologo /fo $@ $<
+# ---- Linken der Executable ----
+
+# Alle Objektdateien + Ressourcen → scanner.exe
$(EXE): $(OBJ) $(RES)
$(LINK) $(LDFLAGS) $(OBJ) $(RES)
+# ---- Aufräumen ----
+
clean:
@if exist $(OUTDIR) del /Q $(OUTDIR)\*.*
@if exist vc140.pdb del vc140.pdb
diff --git a/Makefile.config b/Makefile.config
index 8c3d2b4..65acbaa 100644
--- a/Makefile.config
+++ b/Makefile.config
@@ -1,21 +1,30 @@
-# Makefile.config – zentrale Konfigurationsdatei für MSVC-Build
-# Toolchain
+# Makefile.config – zentrale Buildkonfiguration
+
+# Tools
CC = cl
RC = rc
LINK = link.exe
-# Pfade
-OUTDIR = build\output
-INCLUDEDIR = include
+# Verzeichnisse
SRCDIR = src
RESDIR = resources
+OUTDIR = build\output
+INCLUDEDIR = include
-# Source-Dateien
-SRC = $(SRCDIR)\main.c $(SRCDIR)\app.c
-OBJ = $(OUTDIR)\main.obj $(OUTDIR)\app.obj
+# Flags
+BASE_CFLAGS = /nologo /W4 /I $(INCLUDEDIR)
+BASE_LDFLAGS = /nologo /SUBSYSTEM:CONSOLE /OUT:$(OUTDIR)\scanner.exe
+
+# Debug-abhängige Erweiterungen
+ifeq ($(DEBUG),1)
+ CFLAGS = $(BASE_CFLAGS) /Zi /Od /DDEBUG
+ LDFLAGS = $(BASE_LDFLAGS) /DEBUG /PDB:$(OUTDIR)\scanner.pdb
+else
+ CFLAGS = $(BASE_CFLAGS) /O2
+ LDFLAGS = $(BASE_LDFLAGS)
+endif
+
+# Quell- und Ausgabedateien
+OBJ = $(OUTDIR)\main.obj $(OUTDIR)\app.obj $(OUTDIR)\scanner_config.obj
RES = $(OUTDIR)\version.res
EXE = $(OUTDIR)\scanner.exe
-
-# Standard-Flags (werden dynamisch erweitert)
-BASE_CFLAGS = /nologo /I $(INCLUDEDIR)
-BASE_LDFLAGS = /nologo /SUBSYSTEM:CONSOLE /OUT:$(EXE)
diff --git a/README.md b/README.md
index f63595e..fa78246 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,7 @@
# ⚙️ CLI-Template für C (MSVC)
+
+
Ein leichtgewichtiges C-Projekttemplate für die Kommandozeile unter Windows, vorbereitet für den Microsoft Visual C Compiler (MSVC).
## Inhalt
@@ -9,19 +11,28 @@ Ein leichtgewichtiges C-Projekttemplate für die Kommandozeile unter Windows, vo
- [Features](#features)
- [Struktur](#struktur)
- [Voraussetzungen](#voraussetzungen)
+ - [Compiler (MSVC)](#compiler-msvc)
+ - [Make (empfohlen: MSYS2)](#make-empfohlen-msys2)
- [Nutzung](#nutzung)
+ - [Build](#build)
+ - [Optionen](#optionen)
- [Dokumentation](#dokumentation)
- [Plattformhinweis](#plattformhinweis)
+ - [Geplante Features](#geplante-features)
+ - [Lizenz](#lizenz)
---
## Features
-- Rekursive Verzeichnissuche mit ASCII-Ausgabe
-- Kompatibel mit `cl.exe` über `build.cmd`
-- Debugging per `launch.json` (VS Code)
-- Unicode-Ausgabe (📁 📄) für unterstützende Terminals
-- Struktur für sauberen Code (main + Module)
+- Rekursive Verzeichnissuche mit Unicode-Symbolen (📁 📄)
+- Optionale Tiefenbegrenzung via `--depth N`
+- Limitierung der Dateiausgabe pro Verzeichnis via `--limit N`
+- Unicode-fähige Konsolenausgabe auf Windows (`SetConsoleOutputCP`)
+- Debugging vorbereitet via `launch.json` (VS Code)
+- Sauber modularisierter Code (main + Module + Config)
+- MSVC-kompatibles Buildsystem (`cl.exe` + `rc.exe` + `link.exe`)
+- Unterstützt `Makefile` + `Makefile.config` für Debug/Release
[⚓](#inhalt)
@@ -29,39 +40,29 @@ Ein leichtgewichtiges C-Projekttemplate für die Kommandozeile unter Windows, vo
## Struktur
-Alle notwendigen Verzeichnisse und Dateien wurden mit ✅ markiert, diese sind unverzichtbar für das Projekt.
-Ohne diese, ist ein compilieren nicht möglich.
-Dateien und Verzeichnisse die mit ❌ markiert wurden, können theoretisch gelöscht werden und für den Buildprozess nicht notwendig.
+Alle notwendigen Verzeichnisse und Dateien wurden mit ✅ markiert, diese sind unverzichtbar für den Buildprozess.
+❌ markiert alles, was optional ist oder ignoriert werden kann.
```plaintext
-📁 treescanner # Projekt-Wurzelverzeichnis (Repository-Root)
- 📁 .vscode # ❌ Konfigurationsverzeichnis für Visual Studio Code
- 📄 c_cpp_properties.json # ❌ IntelliSense-Einstellungen (Compilerpfade, Defines etc.)
- 📄 extensions.json # ❌ Empfehlung installierbarer VS Code Extensions
- 📄 launch.json # ❌ Debug-Konfiguration (z. B. Programm, Argumente, Terminal)
- 📄 settings.json # ❌ Editor-spezifische Projekteinstellungen (z. B. Tabs, Formatierung)
- 📄 tasks.json # ❌ Build-Tasks (z. B. MSVC Build über build.cmd)
- 📁 build # ✅ Build-Artefakte (ausgabeorientiertes Verzeichnis)
- 📄 .gitkeep # ❌ Platzhalterdatei, damit Git leere Verzeichnisse behält
- 📁 output # ✅ Output-Ordner für kompilierte Binärdateien und Objekte
- 📄 app.obj # ❌ Objektdatei aus app.c
- 📄 main.obj # ❌ Objektdatei aus main.c
- 📄 treescanner.exe # ❌ Kompilierte lauffähige .exe-Datei
- 📁 doc # ❌ Dokumentation und Templates
- 📁 media # ❌ Dateien für GitHub und Dokumentation
- 📁 resources # ✅ Dateien die zum compilieren benötigt werden (Icon, Metadaten etc.)
- 📁 include # ✅ Header-Dateien für Funktionsprototypen
- 📄 app.h # ✅ Deklaration von `scan_directory()`
- 📄 LICENSE # ❌ Lizenzdatei (hier: MIT License)
- 📄 README.md # ❌ Projektdokumentation (Nutzung, Build, Features etc.)
- 📁 src # ✅ Quellcode-Verzeichnis (.c-Dateien)
- 📄 app.c # ✅ Implementierung der rekursiven Verzeichnissuche
- 📄 main.c # ✅ Einstiegspunkt (main-Funktion)
- 📄 VERSION # ❌ Datei mit Versionsnummer (z. B. „0.1.0-dev“)
- 📄 .gitattributes # ❌ Git-spezifische Datei (z. B. Zeilenenden, Binärdateien, Sprache)
- 📄 .gitignore # ❌ Liste auszuschließender Dateien und Verzeichnisse (z. B. *.exe, /build/)
- 📄 build.cmd # ✅ Build-Skript für MSVC (ruft cl.exe via vcvars64.bat)
- 📄 clean.cmd # ❌ Hilfsskript zum Löschen von build/output
+📁 treescanner
+ 📁 .vscode # ❌ VS Code-Konfiguration (Debug, Build, Editor-Style)
+ 📄 launch.json # ❌ Debug-Konfiguration (z. B. scanner.exe + Breakpoints)
+ 📄 tasks.json # ❌ Build-Task für Make unter Windows
+ 📁 build # ✅ Buildverzeichnis
+ 📁 output # ✅ Kompilierte .exe und .obj-Dateien
+ 📁 include # ✅ Header-Dateien
+ 📄 app.h # ✅ Schnittstelle für scan_directory()
+ 📄 scanner_config.h # ✅ Konfiguration für Tiefen-/Limitsteuerung
+ 📁 resources # ✅ Ressourcen wie version.rc
+ 📄 version.rc # ✅ Icon- und Versionsdefinition
+ 📁 src # ✅ Quellcode (.c-Dateien)
+ 📄 main.c # ✅ Einstiegspunkt mit Argumentverarbeitung
+ 📄 app.c # ✅ rekursiver Verzeichnisscan (Windows API)
+ 📄 scanner_config.c # ✅ Initialisierung und Verwaltung der Konfiguration
+ 📄 build.cmd # ✅ Buildskript (ruft `vcvars64.bat` und `make` auf)
+ 📄 clean.cmd # ✅ Löscht `/build/output` + ggf. `.pdb`
+ 📄 README.md # ❌ Diese Datei
+ 📄 .gitignore # ❌ Ignoriert z. B. *.obj, *.pdb, /build/
```
[⚓](#inhalt)
@@ -70,16 +71,14 @@ Dateien und Verzeichnisse die mit ❌ markiert wurden, können theoretisch gelö
## Voraussetzungen
-### Compiler
-
-#### MSVC
+### Compiler (MSVC)
- [Visual Studio Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/)
-- MSVC `cl.exe` + `vcvars64.bat` korrekt eingebunden
+- Umgebung wird über `vcvars64.bat` gesetzt
### Make (empfohlen: MSYS2)
-- [x] MSYS2 ->
+- [x] `make` aus MSYS2 installieren: `pacman -S make`
[⚓](#inhalt)
@@ -87,12 +86,27 @@ Dateien und Verzeichnisse die mit ❌ markiert wurden, können theoretisch gelö
## Nutzung
+### Build
+
```cmd
build.cmd
```
-**Ausgabe:**
- `build/output/scanner.exe`
+→ erzeugt `build/output/scanner.exe`
+
+### Optionen
+
+```cmd
+scanner.exe [verzeichnis] [--depth N] [--limit N]
+```
+
+Beispiele:
+
+```cmd
+scanner.exe
+scanner.exe "D:\Projekte" --depth 3
+scanner.exe . --limit 5
+```
[⚓](#inhalt)
@@ -100,8 +114,8 @@ build.cmd
## Dokumentation
-- [x] [C Code Style Guide für CLI-Projekte](./doc/code_style.md)
-- [x] [Windows API Referenz – CLI-Toolkit](./doc/index.md)
+- [x] [Code Style Guide (C für CLI-Projekte)](./doc/code_style.md)
+- [x] [Windows API Referenz](./doc/index.md)
[⚓](#inhalt)
@@ -109,9 +123,39 @@ build.cmd
## Plattformhinweis
-> ℹ️ Dieses Projekt ist aktuell auf **Windows** ausgelegt (MSVC, Windows API).
-> Es enthält jedoch bereits `#ifdef _WIN32`-Konstrukte zur Vorbereitung einer plattformübergreifenden Umsetzung.
-> Die POSIX-Version (`opendir`, `readdir`) kann später leicht ergänzt werden.
+> ℹ️ Aktuell ausschließlich für **Windows** (MSVC / WinAPI) vorgesehen.
+> POSIX-Implementierung (`opendir`, `readdir`) ist vorbereitet aber nicht aktiv.
+
+[⚓](#inhalt)
+
+---
+
+## Geplante Features
+
+| Funktion / Option | Beschreibung | Status |
+| -------------------------- | --------------------------------------------------------------- | ------------- |
+| `--depth N` | Maximale Verzeichnistiefe | ✅ Fertig |
+| `--limit N` | Max. Dateien pro Verzeichnis | ✅ Fertig |
+| `--ignore DIR` | Verzeichnisse ausschließen | ⬜ Geplant |
+| `--output FILE` | Ausgabedatei (Standard: `tree.md`) mit `plaintext`-Block | ⬜ Geplant |
+| ASCII-Baumstruktur (`├──`) | grafische Darstellung mit Baumzeichen → **Standardmäßig aktiv** | ⬜ Geplant |
+| `--no-tree-symbols` | Option zum Deaktivieren der Baumzeichensymbole | ⬜ Geplant |
+| `--console` | explizite Konsolenausgabe einschalten | ⬜ Geplant |
+| `--align-comments` | Ausrichtung von Kommentaren in Spalte | ⬜ Geplant |
+| `--language de/en` | Sprache der Ausgaben und Zusammenfassung | ⬜ Geplant |
+| Scan-Zusammenfassung | Ausgabe: `📦 23 Dateien in 5 Ordnern`, ggf. mit Pfad | ⬜ Geplant |
+| Fortschrittsanzeige | Zeitgesteuerte Live-Ausgabe | ⬜ Optional |
+| POSIX-Kompatibilität | Unterstützung für Linux (`opendir`, `readdir`) | ⬜ Vorbereitet |
+| Symbol-Set anpassbar | Benutzerdefinierte Icons (📁, 📄 etc.) | ⬜ Optional |
+| Laufzeit erfassen | Zu Benchmarkzwecken Durchlaufzeit erfassen von Start bis Ende | ✅ Fertig |
+
+[⚓](#inhalt)
+
+---
+
+## Lizenz
+
+MIT siehe Datei [LICENSE](./LICENSE)
[⚓](#inhalt)
diff --git a/VERSION b/VERSION
index 6d7de6e..9084fa2 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.0.2
+1.1.0
diff --git a/include/app.h b/include/app.h
index 0e1dfb2..1c62d8d 100644
--- a/include/app.h
+++ b/include/app.h
@@ -1,6 +1,7 @@
#ifndef APP_H
#define APP_H
+#include "scanner_config.h"
/**
* @brief Recursively scans the specified directory and prints an ASCII tree.
*
@@ -11,6 +12,6 @@
* @param base_path The root directory to scan
* @param depth Current recursion depth, used for visual indentation
*/
-void scan_directory(const char *base_path, int depth);
+void scan_directory(const char *path, int depth, const ScannerConfig *config);
-#endif
+#endif
\ No newline at end of file
diff --git a/include/scanner_config.h b/include/scanner_config.h
new file mode 100644
index 0000000..bc944f9
--- /dev/null
+++ b/include/scanner_config.h
@@ -0,0 +1,11 @@
+#ifndef SCANNER_CONFIG_H
+#define SCANNER_CONFIG_H
+
+typedef struct {
+ int max_depth;
+ int max_files_per_dir;
+} ScannerConfig;
+
+void init_config_defaults(ScannerConfig *config);
+
+#endif
diff --git a/media/logo-alpha-256x256.png b/media/logo-alpha-256x256.png
new file mode 100644
index 0000000..445ed36
Binary files /dev/null and b/media/logo-alpha-256x256.png differ
diff --git a/media/logo-alpha-512x512.png b/media/logo-alpha-512x512.png
new file mode 100644
index 0000000..5324c89
Binary files /dev/null and b/media/logo-alpha-512x512.png differ
diff --git a/src/app.c b/src/app.c
index bf96aea..74f717b 100644
--- a/src/app.c
+++ b/src/app.c
@@ -18,7 +18,9 @@
* @param base_path Root path to scan
* @param depth Recursion depth for indentation
*/
-void scan_directory(const char *base_path, int depth) {
+void scan_directory(const char *base_path, int depth, const ScannerConfig *config) {
+ if (config->max_depth >= 0 && depth > config->max_depth)
+ return;
#ifdef _WIN32
WIN32_FIND_DATA find_data;
char search_path[MAX_PATH];
@@ -31,6 +33,8 @@ void scan_directory(const char *base_path, int depth) {
return;
}
+ int file_count = 0;
+
do {
const char *name = find_data.cFileName;
if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0)
@@ -41,8 +45,11 @@ void scan_directory(const char *base_path, int depth) {
printf("📁 %s\n", name);
char sub_path[MAX_PATH];
snprintf(sub_path, MAX_PATH, "%s\\%s", base_path, name);
- scan_directory(sub_path, depth + 1);
+ scan_directory(sub_path, depth + 1, config);
} else {
+ if (config->max_files_per_dir >= 0 && file_count >= config->max_files_per_dir)
+ continue;
+ file_count++;
printf("📄 %s\n", name);
}
diff --git a/src/main.c b/src/main.c
index a356ce1..ff44425 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,28 +1,36 @@
-#ifdef _WIN32
-#include
-#endif
+#include // hinzugefügt für GetTickCount64
#include
+#include
#include "app.h"
+#include "scanner_config.h"
-/**
- * @brief Entry point of the CLI tool.
- *
- * Initializes UTF-8 output on Windows, then calls scan_directory()
- * with the provided argument or current directory.
- *
- * @param argc Number of arguments
- * @param argv Array of argument strings
- * @return int Exit status
- */
int main(int argc, char *argv[]) {
#ifdef _WIN32
- SetConsoleOutputCP(CP_UTF8); // Enable Unicode output on Windows
+ SetConsoleOutputCP(CP_UTF8);
#endif
- printf("[INFO] 🔍 CLI Tool gestartet\n");
+ ScannerConfig config;
+ init_config_defaults(&config);
- const char *pfad = (argc > 1) ? argv[1] : ".";
- scan_directory(pfad, 0);
+ const char *pfad = ".";
+
+ for (int i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "--depth") == 0 && i + 1 < argc)
+ config.max_depth = atoi(argv[++i]);
+ else if (strcmp(argv[i], "--limit") == 0 && i + 1 < argc)
+ config.max_files_per_dir = atoi(argv[++i]);
+ else
+ pfad = argv[i];
+ }
+
+ printf("\n[ℹ️] 🔍 CLI Tool gestartet\n\n");
+
+ ULONGLONG start_ms = GetTickCount64();
+
+ scan_directory(pfad, 0, &config);
+
+ ULONGLONG end_ms = GetTickCount64();
+ printf("\n[ℹ️] ⌛ Laufzeit des Scans: %llu ms\n\n", end_ms - start_ms);
return 0;
}
diff --git a/src/scanner_config.c b/src/scanner_config.c
new file mode 100644
index 0000000..423f503
--- /dev/null
+++ b/src/scanner_config.c
@@ -0,0 +1,6 @@
+#include "scanner_config.h"
+
+void init_config_defaults(ScannerConfig *config) {
+ config->max_depth = -1; // unbegrenzt
+ config->max_files_per_dir = -1; // unbegrenzt
+}