# ROM Groomer Project Structure This document describes the directory structure and organization of the ROM Groomer project. ## Directory Structure ``` rom-groomer/ ├── bin/ # User-facing script symlinks (add to PATH) ├── builders/ # ROM set build scripts ├── converters/ # File format conversion scripts ├── core/ # Essential shared libraries and configuration ├── docs/ # Documentation and guides ├── examples/ # Example configurations and usage ├── organizers/ # ROM organization and management scripts ├── systems/ # System-specific configurations ├── tests/ # Test scripts and coverage analysis ├── tools/ # Utility scripts and helper tools ├── archive/ # Legacy files and documentation ├── LICENSE # Project license └── README.md # Main project documentation ``` ## Directory Details ### `/bin/` - User-facing Scripts Contains symlinks to the most commonly used scripts. Add this directory to your PATH for easy access. **Key Scripts:** - `convertFromZipCueToOggCue.sh` → `../converters/convertFromZipCueToOggCue.sh` - `convertFromZipCueToFlacCue.sh` → `../converters/convertFromZipCueToFlacCue.sh` - `organize-roms.sh` → `../organizers/organize-roms.sh` - `sort2folders.sh` → `../organizers/sort2folders.sh` - `unzipfiles.sh` → `../organizers/unzipfiles.sh` - `setup-wizard.sh` → `../tools/setup-wizard.sh` ### `/builders/` - ROM Set Build Scripts System-specific scripts for building 1G1R (One Game One ROM) sets. **Naming Convention:** `build-{system}-{region}-1g1r.sh` **Examples:** - `build-nes-usa-1g1r.sh` - `build-snes-eng-1g1r.sh` - `build-psx-all-1g1r.sh` ### `/converters/` - Format Conversion Scripts Scripts for converting between different ROM and media formats. **Key Scripts:** - `convertFromZipCueToOggCue.sh` - Convert ZIP+CUE to OGG+CUE - `convertFromZipCueToFlacCue.sh` - Convert ZIP+CUE to FLAC+CUE - `convertFromZipCueToChd.sh` - Convert ZIP+CUE to CHD - `convertFromZipToPS3.sh` - Convert ZIP to PS3 format - `convertFromZipToXboxIso.sh` - Convert ZIP to Xbox ISO ### `/core/` - Essential Libraries Core utilities and configuration files used by all scripts. **Key Files:** - `config.sh` - Main configuration and constants - `config-arrays.sh` - Dynamic array definitions - `logger.sh` - Logging utilities with color support - `utils.sh` - Common utility functions - `progress.sh` - Progress indicators and status tracking ### `/docs/` - Documentation Project documentation, guides, and reference materials. **Key Files:** - `AI.md` - AI development and enhancement notes - `ARCHITECTURE.md` - System architecture documentation - `CHANGELOG.md` - Version history and changes - `CONTRIBUTING.md` - Contribution guidelines - `PROJECT_STATUS.md` - Current project status - `ROADMAP.md` - Future development plans ### `/examples/` - Example Configurations Sample configurations, usage examples, and templates. **Contents:** - Example configuration files - Usage scenarios and workflows - Template scripts for new systems ### `/organizers/` - ROM Organization Scripts Scripts for organizing, sorting, and managing ROM collections. **Key Scripts:** - `organize-roms.sh` - Organize ROMs by region, language, or kind - `sort2folders.sh` - Sort ROMs into alphabetical folders - `unzipfiles.sh` - Extract archives with summary reporting - `link-plus.sh` - Create hard/soft links between directories - `delete-listfiles.sh` - Clean up list files ### `/systems/` - System-specific Configurations Configuration files for specific gaming systems. **Examples:** - `custom-nes.sh` - `custom-psx.sh` - `custom-dreamcast.sh` ### `/tests/` - Test Framework Test scripts and coverage analysis for quality assurance. **Key Files:** - Test scripts for individual components - Integration tests - Coverage analysis reports ### `/tools/` - Utility Scripts Helper scripts and utilities for system setup and maintenance. **Key Scripts:** - `setup-wizard.sh` - Interactive first-time setup - `preflight-checks.sh` - System dependency validation - `nointro-processor.sh` - No-Intro DAT processing - `redump-processor.sh` - Redump DAT processing - `scan-archives.sh` - Archive analysis and reporting ## Script Dependencies All scripts use a consistent dependency resolution pattern: ```bash # Determine the directory of the current script SCRIPT_DIR="$(dirname "$(realpath "$0")")" # Determine the project root directory PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" # Load shared libraries source "${PROJECT_ROOT}/core/config.sh" source "${PROJECT_ROOT}/core/logger.sh" # ... other dependencies as needed ``` ## Path Management The project uses relative paths from the project root to ensure portability: - **Core libraries:** `${PROJECT_ROOT}/core/` - **Cross-references:** `${PROJECT_ROOT}/{directory}/` - **Configuration files:** Located in project root or `core/` ## Usage Patterns ### Direct Script Execution ```bash # From project root ./converters/convertFromZipCueToOggCue.sh input.zip # From any directory (if bin/ is in PATH) convertFromZipCueToOggCue.sh input.zip ``` ### Batch Operations ```bash # Organize ROMs by region ./organizers/organize-roms.sh /path/to/roms --region # Sort into alphabetical folders ./organizers/sort2folders.sh /path/to/roms ``` ### System Building ```bash # Build NES USA 1G1R set ./builders/build-nes-usa-1g1r.sh # Build multiple systems for system in nes snes gba; do ./builders/build-${system}-usa-1g1r.sh done ``` ## Best Practices 1. **Always use absolute paths** when calling scripts programmatically 2. **Add `bin/` to your PATH** for convenient access to common scripts 3. **Use the setup wizard** for initial configuration 4. **Check dependencies** with preflight checks before major operations 5. **Use dry-run mode** when testing new configurations 6. **Review logs** in the project's log directory for troubleshooting ## Migration from Previous Structure If migrating from an older version of ROM Groomer: 1. **Update any custom scripts** that reference the old paths 2. **Re-run the setup wizard** to update configuration 3. **Update PATH** to point to the new `bin/` directory 4. **Review and update** any automation scripts ## Development When adding new scripts: 1. **Place in appropriate directory** based on functionality 2. **Use the standard dependency pattern** for loading core libraries 3. **Add symlinks** in `bin/` for user-facing scripts 4. **Update documentation** including this structure guide 5. **Add tests** in the `tests/` directory