Windows rename fix + Compressing message
This commit is contained in:
parent
5a0e77e9ac
commit
7fdb310f93
|
@ -4,7 +4,7 @@ project(caesiumclt)
|
||||||
# The version number.
|
# The version number.
|
||||||
set(VERSION_MAJOR 0)
|
set(VERSION_MAJOR 0)
|
||||||
set(VERSION_MINOR 15)
|
set(VERSION_MINOR 15)
|
||||||
set(VERSION_PATCH 0)
|
set(VERSION_PATCH 1)
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
"src/config.h.in"
|
"src/config.h.in"
|
||||||
|
@ -13,7 +13,7 @@ configure_file(
|
||||||
|
|
||||||
include_directories("${PROJECT_BINARY_DIR}")
|
include_directories("${PROJECT_BINARY_DIR}")
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
include_directories("C:\\libcaesium\\caesium")
|
include_directories("C:\\libcaesium")
|
||||||
else ()
|
else ()
|
||||||
include_directories("/usr/local/include")
|
include_directories("/usr/local/include")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
19
README.md
19
README.md
|
@ -1,5 +1,5 @@
|
||||||
## Caesium CommandLineTools
|
## Caesium CommandLineTools
|
||||||
##### caesium-clt - v0.15.0-beta (build 20191223) - Copyright © Matteo Paonessa, 2019. All Rights Reserved.
|
##### caesium-clt - v0.15.1-beta (build 20200123) - Copyright © Matteo Paonessa, 2020. All Rights Reserved.
|
||||||
[](https://travis-ci.org/Lymphatus/caesium-clt)
|
[](https://travis-ci.org/Lymphatus/caesium-clt)
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
||||||
###### TESTED PLATFORMS
|
###### TESTED PLATFORMS
|
||||||
* Mac OS X Catalina (v10.15)
|
* Mac OS X Catalina (v10.15)
|
||||||
* Ubuntu 19.04
|
* Ubuntu 19.04
|
||||||
|
* Windows 10
|
||||||
|
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
@ -90,13 +91,9 @@ $ caesiumclt -q 0 -RS -o ~/output/ ~/Pictures
|
||||||
|
|
||||||
----------
|
----------
|
||||||
|
|
||||||
###### TODO
|
|
||||||
* Code cleaning
|
|
||||||
* Deeper error handling
|
|
||||||
|
|
||||||
----------
|
|
||||||
|
|
||||||
###### CHANGELOG
|
###### CHANGELOG
|
||||||
|
* 0.15.1-beta - Fixed rename bug on Windows + "Compressing..." message
|
||||||
|
* 0.15.0-beta - Support for libcaesium 0.5.0
|
||||||
* 0.14.0-beta - Added --quiet option
|
* 0.14.0-beta - Added --quiet option
|
||||||
* 0.13.1-beta - Bugfix
|
* 0.13.1-beta - Bugfix
|
||||||
* 0.13.0-beta - Bugfix
|
* 0.13.0-beta - Bugfix
|
||||||
|
@ -107,11 +104,3 @@ $ caesiumclt -q 0 -RS -o ~/output/ ~/Pictures
|
||||||
* 0.10.1-beta - All features are available
|
* 0.10.1-beta - All features are available
|
||||||
* 0.10.0-beta - Switched to cmake build system and libcaesium
|
* 0.10.0-beta - Switched to cmake build system and libcaesium
|
||||||
* 0.9.1-beta - Initial development stage
|
* 0.9.1-beta - Initial development stage
|
||||||
|
|
||||||
----------
|
|
||||||
|
|
||||||
###### RESOURCES
|
|
||||||
* caesium-clt website - [http://saerasoft.com/caesium/clt](http://saerasoft.com/caesium/clt)
|
|
||||||
* Caesium website - [http://saerasoft.com/caesium](http://saerasoft.com/caesium)
|
|
||||||
* caesium-clt Git Repository - [https://github.com/Lymphatus/caesium-clt](https://github.com/Lymphatus/caesium-clt)
|
|
||||||
* Author website - SaeraSoft - [http://saerasoft.com](http://saerasoft.com)
|
|
||||||
|
|
10
src/helper.c
10
src/helper.c
|
@ -299,12 +299,12 @@ int start_compression(cclt_options *options, cs_image_pars *parameters) {
|
||||||
overwriting = true;
|
overwriting = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
print_to_console(stdout, verbose, "(%d/%d) %s -> %s\n",
|
print_to_console(stdout, verbose, "(%d/%d) %s -> %s\nCompressing...",
|
||||||
i + 1,
|
i + 1,
|
||||||
options->files_count,
|
options->files_count,
|
||||||
filename,
|
filename,
|
||||||
f_exists ? original_output_full_path : output_full_path);
|
f_exists ? original_output_full_path : output_full_path);
|
||||||
|
fflush(stdout);
|
||||||
//Prevent compression if running in dry mode
|
//Prevent compression if running in dry mode
|
||||||
if (!options->dry_run) {
|
if (!options->dry_run) {
|
||||||
if (cs_compress(options->input_files[i], output_full_path, parameters, &compression_error_code)) {
|
if (cs_compress(options->input_files[i], output_full_path, parameters, &compression_error_code)) {
|
||||||
|
@ -321,11 +321,12 @@ int start_compression(cclt_options *options, cs_image_pars *parameters) {
|
||||||
goto free_and_go_on_with_next_file;
|
goto free_and_go_on_with_next_file;
|
||||||
}
|
}
|
||||||
options->output_total_size += output_file_size;
|
options->output_total_size += output_file_size;
|
||||||
print_to_console(stdout, verbose, "%s -> %s [%.2f%%]\n",
|
print_to_console(stdout, verbose, "\r%s -> %s [%.2f%%]\n",
|
||||||
human_input_size,
|
human_input_size,
|
||||||
human_output_size,
|
human_output_size,
|
||||||
((float) output_file_size - input_file_size) * 100 / input_file_size);
|
((float) output_file_size - input_file_size) * 100 / input_file_size);
|
||||||
} else {
|
} else {
|
||||||
|
print_to_console(stdout, verbose, "\n");
|
||||||
print_to_console(stderr, verbose, "Compression failed with error %d\n", compression_error_code);
|
print_to_console(stderr, verbose, "Compression failed with error %d\n", compression_error_code);
|
||||||
options->input_total_size -= get_file_size(options->input_files[i]);
|
options->input_total_size -= get_file_size(options->input_files[i]);
|
||||||
}
|
}
|
||||||
|
@ -333,6 +334,9 @@ int start_compression(cclt_options *options, cs_image_pars *parameters) {
|
||||||
|
|
||||||
//Rename if we were overwriting
|
//Rename if we were overwriting
|
||||||
if (overwriting && !options->dry_run) {
|
if (overwriting && !options->dry_run) {
|
||||||
|
#ifdef _WIN32
|
||||||
|
remove(original_output_full_path);
|
||||||
|
#endif
|
||||||
rename(output_full_path, original_output_full_path);
|
rename(output_full_path, original_output_full_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue