Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portable version of app #1464

Merged
merged 22 commits into from
Mar 11, 2025
Merged

Portable version of app #1464

merged 22 commits into from
Mar 11, 2025

Conversation

qarmin
Copy link
Owner

@qarmin qarmin commented Mar 8, 2025

  • ability to configure config/cache path, by setting CONFIG_PATH and CACHE_PATH env
CONFIG_PATH="/media/rafal/Ventoy/config" CACHE_PATH="/media/rafal/Ventoy/cache" krokiet
  • moving tools code to tools directory
  • fixes debug crash when checking for broken files, files with full name .mp3 (without file name)
  • added size progress also to cli
  • added to cli, ability to not print results to terminal
  • fixed not clearing last progress message

Fixes #1061
Fixes #519

@qarmin qarmin requested a review from Copilot March 9, 2025 08:05
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR implements a portable version of the app by enabling configuration of the config and cache paths via environment variables, moving various tools-related modules into a dedicated tools directory, and addressing a debug crash when handling file names without inner names (e.g. ".mp3").

  • Added new functions to set and retrieve configuration/cache paths
  • Relocated and updated tools-related modules and imports
  • Improved logging and error handling in file extension checks and cache operations

Reviewed Changes

File Description
czkawka_core/src/common.rs Adds config/cache path support, a new make_hard_link function, and updates open_cache_folder
czkawka_core/src/tools/broken_files.rs Updates error logging for file name processing in extension checks
czkawka_core/Cargo.toml Bumps bincode dependency version with a cautionary note
czkawka_core/src/tools/mod.rs Organizes tool modules
Cargo.toml Updates informational comments on overflow check behavior
README.md Refines feature list description
czkawka_cli/src/main.rs Adjusts CLI initialization to account for new config/cache path setting
czkawka_core/src/tools/duplicate.rs Refactors hard link functionality by removing a redundant implementation
czkawka_cli/src/commands.rs Updates module import paths for several tools components
czkawka_core/src/common_cache.rs Enhances logging with cache file sizes
czkawka_core/src/lib.rs Migrates several modules into the new tools directory
czkawka_core/src/tools/same_music.rs Updates test imports for simplified naming logic
czkawka_core/src/tools/similar_images.rs Updates import paths accordingly
czkawka_core/benches/hash_calculation_benchmark.rs Updates import paths for duplicate hashing functions

Copilot reviewed 61 out of 61 changed files in this pull request and generated 1 comment.

@qarmin qarmin requested a review from Copilot March 9, 2025 12:00
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

Portable version of the app with enhanced configurability and refactoring.

  • Enables custom configuration by reading CONFIG_PATH and CACHE_PATH environment variables.
  • Moves legacy tools into a dedicated tools directory and adjusts module paths.
  • Fixes debug crashes and improves CLI feedback (size progress, terminal output control, progress message clearing).

Reviewed Changes

File Description
czkawka_core/src/common.rs Adds config/cache path resolution using OnceCell and environment vars.
czkawka_cli/src/progress.rs Updates progress bar handling and error messaging in progress flows.
czkawka_core/Cargo.toml Adjusts bincode version requirement and updates dependency comments.
czkawka_core/src/tools/mod.rs Moves various tool modules into the new tools directory.
czkawka_core/src/tools/broken_files.rs Improves logging and error handling in file extension checks.
czkawka_cli/src/main.rs Adjusts CLI startup flow to incorporate new config/cache setup and exit codes.
czkawka_cli/src/commands.rs Updates module paths and adds new CLI options to control printed output.
czkawka_core/src/common_cache.rs Enhances cache file logging by including file size information.
czkawka_core/src/tools/duplicate.rs Removes the redundant hard link creation function as part of refactoring.

Copilot reviewed 65 out of 65 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

czkawka_cli/src/commands.rs:483

  • [nitpick] Consider renaming the flags in the DoNotPrint struct (e.g., to 'suppress_output' and 'suppress_messages') for improved clarity and to better reflect their behavior.
    #[clap(flatten)]
    pub do_not_print: DoNotPrint,

@qarmin qarmin requested a review from Copilot March 10, 2025 18:10
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR introduces a portable configuration for cache and config paths via environment variables, moves various tool modules to a dedicated tools directory, and fixes several issues including a debug crash when processing files named “.mp3”.

  • Added configurable config/cache paths using the CONFIG_PATH and CACHE_PATH environment variables
  • Reorganized and modularized the code by moving tools-related logic into a dedicated directory
  • Adjusted CLI behavior and exit code handling, and fixed error reporting in file extension checking

Reviewed Changes

File Description
czkawka_core/src/common.rs Added configuration cache path support and refactored hard link creation
czkawka_cli/src/progress.rs Incorporated human-readable file size formatting in progress bars
czkawka_core/src/tools/broken_files.rs Improved error logging for missing file names and unknown extensions
czkawka_core/Cargo.toml & czkawka_cli/Cargo.toml Updated dependency versions and added new dependencies
czkawka_cli/src/main.rs Integrated config path initialization and updated exit logic
czkawka_cli/src/commands.rs Modified CLI argument help texts and added new flags
czkawka_core/src/common_cache.rs Enhanced cache logging with file size information
ci_tester/src/main.rs Updated test commands to include new flags
... Other minor refactorings and dependency adjustments

Copilot reviewed 68 out of 68 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

czkawka_cli/src/main.rs:91

  • Consider defining a named constant for the exit code 11 to improve code clarity and maintainability.
if found_any_files.load(std::sync::atomic::Ordering::SeqCst) { std::process::exit(11); } else { ... }

@qarmin qarmin merged commit cb5a54b into master Mar 11, 2025
32 checks passed
@qarmin qarmin deleted the multi branch March 11, 2025 16:14
@God-damnit-all
Copy link

It's kind of bad that these env variables aren't named after czkawka in any way, plenty of different things could use CONFIG_PATH and CACHE_PATH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

please make a full portable version [FR] Save config/cache to exe's "user" directory if it exists
2 participants