Fixing paths
This commit is contained in:
parent
a0cd632098
commit
a0f1a34f14
|
@ -10,6 +10,163 @@ Thumbs.db
|
||||||
.Spotlight-V100
|
.Spotlight-V100
|
||||||
.Trashes
|
.Trashes
|
||||||
|
|
||||||
.idea
|
### JetBrains template
|
||||||
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
||||||
|
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||||
|
|
||||||
|
# User-specific stuff:
|
||||||
|
.idea/**/workspace.xml
|
||||||
|
.idea/**/tasks.xml
|
||||||
|
.idea/dictionaries
|
||||||
|
|
||||||
|
# Sensitive or high-churn files:
|
||||||
|
.idea/**/dataSources/
|
||||||
|
.idea/**/dataSources.ids
|
||||||
|
.idea/**/dataSources.xml
|
||||||
|
.idea/**/dataSources.local.xml
|
||||||
|
.idea/**/sqlDataSources.xml
|
||||||
|
.idea/**/dynamic.xml
|
||||||
|
.idea/**/uiDesigner.xml
|
||||||
|
|
||||||
|
# Gradle:
|
||||||
|
.idea/**/gradle.xml
|
||||||
|
.idea/**/libraries
|
||||||
|
|
||||||
|
# CMake
|
||||||
cmake-build-*
|
cmake-build-*
|
||||||
build
|
|
||||||
|
# Mongo Explorer plugin:
|
||||||
|
.idea/**/mongoSettings.xml
|
||||||
|
|
||||||
|
## File-based project format:
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
## Plugin-specific files:
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
.idea_modules/
|
||||||
|
|
||||||
|
# JIRA plugin
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
|
||||||
|
# Cursive Clojure plugin
|
||||||
|
.idea/replstate.xml
|
||||||
|
|
||||||
|
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||||
|
com_crashlytics_export_strings.xml
|
||||||
|
crashlytics.properties
|
||||||
|
crashlytics-build.properties
|
||||||
|
fabric.properties
|
||||||
|
### macOS template
|
||||||
|
# General
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Icon must end with two \r
|
||||||
|
Icon
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
|
||||||
|
# Files that might appear in the root of a volume
|
||||||
|
.DocumentRevisions-V100
|
||||||
|
.fseventsd
|
||||||
|
.TemporaryItems
|
||||||
|
.VolumeIcon.icns
|
||||||
|
.com.apple.timemachine.donotpresent
|
||||||
|
|
||||||
|
# Directories potentially created on remote AFP share
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
||||||
|
### Linux template
|
||||||
|
*~
|
||||||
|
|
||||||
|
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||||
|
.fuse_hidden*
|
||||||
|
|
||||||
|
# KDE directory preferences
|
||||||
|
.directory
|
||||||
|
|
||||||
|
# Linux trash folder which might appear on any partition or disk
|
||||||
|
.Trash-*
|
||||||
|
|
||||||
|
# .nfs files are created when an open file is removed but is still being accessed
|
||||||
|
.nfs*
|
||||||
|
### Windows template
|
||||||
|
# Windows thumbnail cache files
|
||||||
|
ehthumbs.db
|
||||||
|
ehthumbs_vista.db
|
||||||
|
|
||||||
|
# Dump file
|
||||||
|
*.stackdump
|
||||||
|
|
||||||
|
# Folder config file
|
||||||
|
[Dd]esktop.ini
|
||||||
|
|
||||||
|
# Recycle Bin used on file shares
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# Windows Installer files
|
||||||
|
*.cab
|
||||||
|
*.msi
|
||||||
|
*.msm
|
||||||
|
*.msp
|
||||||
|
|
||||||
|
# Windows shortcuts
|
||||||
|
*.lnk
|
||||||
|
### C template
|
||||||
|
# Prerequisites
|
||||||
|
*.d
|
||||||
|
|
||||||
|
# Object files
|
||||||
|
*.o
|
||||||
|
*.ko
|
||||||
|
*.obj
|
||||||
|
*.elf
|
||||||
|
|
||||||
|
# Linker output
|
||||||
|
*.ilk
|
||||||
|
*.map
|
||||||
|
*.exp
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Libraries
|
||||||
|
*.lib
|
||||||
|
*.a
|
||||||
|
*.la
|
||||||
|
*.lo
|
||||||
|
|
||||||
|
# Shared objects (inc. Windows DLLs)
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
*.i*86
|
||||||
|
*.x86_64
|
||||||
|
*.hex
|
||||||
|
|
||||||
|
# Debug files
|
||||||
|
*.dSYM/
|
||||||
|
*.su
|
||||||
|
*.idb
|
||||||
|
*.pdb
|
||||||
|
|
||||||
|
# Kernel Module Compile Results
|
||||||
|
*.mod*
|
||||||
|
*.cmd
|
||||||
|
.tmp_versions/
|
||||||
|
modules.order
|
||||||
|
Module.symvers
|
||||||
|
Mkfile.old
|
||||||
|
dkms.conf
|
|
@ -0,0 +1 @@
|
||||||
|
caesiumclt
|
|
@ -0,0 +1,2 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
|
@ -0,0 +1,125 @@
|
||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="ClangTidyInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="DeprecatedAPI" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="DuplicateSwitchCase" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="EndlessLoop" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="EqualityInConditionalOperator" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="FormatSpecifiers" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="FunctionImplicitDeclarationInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="HidesUpperScope" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="HidingNonVirtualFunction" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="ImplicitIntegerAndEnumConversion" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="ImplicitPointerAndIntegerConversion" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="IncompatibleEnums" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="IncompatibleInitializers" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="IncompatiblePointers" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="InfiniteRecursion" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="KRUnspecifiedParameters" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="LocalValueEscapesScope" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="MissingReturn" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="MissingSwitchCase" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="NotImplementedFunctions" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="NotInitializedVariable" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="NotSuperclass" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="OCDFAInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="OCLoopDoesntUseConditionVariableInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="OCSimplifyInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="OCUnusedGlobalDeclarationInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="OCUnusedMacroInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="OCUnusedStructInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="OCUnusedTemplateParameterInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="RedundantCast" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="ResourceNotFoundInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="SignednessMismatch" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="UnreachableCode" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="UnusedExpressionResult" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="UnusedImportStatement" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="UnusedLocalVariable" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="UnusedLocalization" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="UnusedParameter" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="UnusedValue" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="ValueMayNotFitIntoReceiver" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<scope name="Inspection" level="WARNING" enabled="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||||
|
<component name="CidrRootsConfiguration">
|
||||||
|
<sourceRoots>
|
||||||
|
<file path="$PROJECT_DIR$/src" />
|
||||||
|
</sourceRoots>
|
||||||
|
<excludeRoots>
|
||||||
|
<file path="$PROJECT_DIR$/cmake-build-debug/CMakeFiles" />
|
||||||
|
</excludeRoots>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/caesium-clt.iml" filepath="$PROJECT_DIR$/.idea/caesium-clt.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<component name="DependencyValidationManager">
|
||||||
|
<scope name="Inspection" pattern="!file:src/optparse.c&&!file:src/optparse.h&&!file:src/tinydir.h&&!file:.gitignore" />
|
||||||
|
</component>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
60
src/helper.c
60
src/helper.c
|
@ -7,7 +7,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#define getcwd _getcwd
|
#define getcwd _getcwd
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "helper.h"
|
#include "helper.h"
|
||||||
|
@ -40,33 +40,27 @@ cclt_options parse_arguments(char **argv, cs_image_pars *options)
|
||||||
while ((option = optparse_long(&opts, longopts, NULL)) != -1) {
|
while ((option = optparse_long(&opts, longopts, NULL)) != -1) {
|
||||||
switch (option) {
|
switch (option) {
|
||||||
case 'q':
|
case 'q':
|
||||||
options->jpeg.quality = atoi(opts.optarg);
|
options->jpeg.quality = (int)strtol(opts.optarg, (char **)NULL, 10);;
|
||||||
if (options->jpeg.quality < 0 || options->jpeg.quality > 100) {
|
if (options->jpeg.quality < 0 || options->jpeg.quality > 100) {
|
||||||
display_error(ERROR, 1);
|
display_error(ERROR, 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
options->jpeg.exif_copy = true;
|
options->jpeg.exif_copy = true;
|
||||||
case 'p':
|
|
||||||
options->jpeg.progressive = false;
|
|
||||||
break;
|
|
||||||
case 'o':
|
case 'o':
|
||||||
realpath(opts.optarg, parameters.output_folder);
|
|
||||||
//TODO Resolve ~
|
|
||||||
if (opts.optarg[0] == '~') {
|
if (opts.optarg[0] == '~') {
|
||||||
snprintf(parameters.output_folder, strlen(parameters.output_folder), "%s", parameters.output_folder);
|
if (opts.optarg[strlen(opts.optarg) - 1] == '/' || opts.optarg[strlen(opts.optarg) - 1] == '\\') {
|
||||||
|
snprintf(parameters.output_folder, strlen(opts.optarg) + 1, "%s", opts.optarg);
|
||||||
|
} else {
|
||||||
|
#ifdef _WIN32
|
||||||
|
snprintf(parameters.output_folder, strlen(opts.optarg) + 2, "%s\\", opts.optarg);
|
||||||
|
#else
|
||||||
|
snprintf(parameters.output_folder, strlen(opts.optarg) + 2, "%s/", opts.optarg);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
realpath(opts.optarg, parameters.output_folder);
|
||||||
}
|
}
|
||||||
// if (opts.optarg[strlen(opts.optarg) - 1] == '/' || opts.optarg[strlen(opts.optarg) - 1] == '\\') {
|
|
||||||
// snprintf(parameters.output_folder, strlen(opts.optarg) + 1, "%s", opts.optarg);
|
|
||||||
// } else {
|
|
||||||
//#ifdef _WIN32
|
|
||||||
// snprintf(parameters.output_folder, strlen(opts.optarg) + 2, "%s\\", opts.optarg);
|
|
||||||
//#else
|
|
||||||
// snprintf(parameters.output_folder, strlen(opts.optarg) + 2, "%s/", opts.optarg);
|
|
||||||
//#endif
|
|
||||||
// }
|
|
||||||
|
|
||||||
//Prepend the current directory if necessary
|
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
parameters.recursive = true;
|
parameters.recursive = true;
|
||||||
|
@ -89,7 +83,6 @@ cclt_options parse_arguments(char **argv, cs_image_pars *options)
|
||||||
display_error(ERROR, 2);
|
display_error(ERROR, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Remaining arguments
|
//Remaining arguments
|
||||||
char *arg;
|
char *arg;
|
||||||
bool files_flag = false, folders_flag = false;
|
bool files_flag = false, folders_flag = false;
|
||||||
|
@ -101,25 +94,23 @@ cclt_options parse_arguments(char **argv, cs_image_pars *options)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check if it's a directory and add its content
|
//Check if it's a directory and add its content
|
||||||
realpath(arg, resolved_path);
|
|
||||||
//TODO Resolve ~
|
|
||||||
if (arg[0] == '~') {
|
if (arg[0] == '~') {
|
||||||
snprintf(resolved_path, strlen(resolved_path), "%s", resolved_path);
|
if (arg[strlen(arg) - 1] == '/' || arg[strlen(arg) - 1] == '\\') {
|
||||||
|
snprintf(resolved_path, strlen(arg), "%s", arg);
|
||||||
|
} else {
|
||||||
|
#ifdef _WIN32
|
||||||
|
snprintf(resolved_path, strlen(arg) + 1, "%s\\", arg);
|
||||||
|
#else
|
||||||
|
snprintf(resolved_path, strlen(arg) + 1, "%s/", arg);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
realpath(arg, resolved_path);
|
||||||
}
|
}
|
||||||
if (is_directory(resolved_path)) {
|
if (is_directory(resolved_path)) {
|
||||||
if (!files_flag) {
|
if (!files_flag) {
|
||||||
folders_flag = true;
|
folders_flag = true;
|
||||||
snprintf(parameters.input_folder, strlen(resolved_path) + 1, "%s", resolved_path);
|
snprintf(parameters.input_folder, strlen(resolved_path) + 1, "%s", resolved_path);
|
||||||
// if (arg[strlen(arg) - 1] == '/' || arg[strlen(arg) - 1] == '\\') {
|
|
||||||
// parameters.input_folder = strdup(arg);
|
|
||||||
// } else {
|
|
||||||
// parameters.input_folder = malloc((strlen(arg) + 2) * sizeof(char));
|
|
||||||
//#ifdef _WIN32
|
|
||||||
// snprintf(parameters.input_folder, (strlen(arg) + 2), "%s\\", arg);
|
|
||||||
//#else
|
|
||||||
// snprintf(parameters.input_folder, (strlen(arg) + 2), "%s/", arg);
|
|
||||||
//#endif
|
|
||||||
// }
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
count = scan_folder(resolved_path, ¶meters, parameters.recursive);
|
count = scan_folder(resolved_path, ¶meters, parameters.recursive);
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
|
@ -199,7 +190,8 @@ int start_compression(cclt_options *options, cs_image_pars *parameters)
|
||||||
snprintf(output_full_folder, strlen(options->output_folder) + size + 1, "%s%s",
|
snprintf(output_full_folder, strlen(options->output_folder) + size + 1, "%s%s",
|
||||||
options->output_folder, &options->input_files[i][index]);
|
options->output_folder, &options->input_files[i][index]);
|
||||||
output_full_path = malloc((strlen(output_full_folder) + strlen(filename) + 1) * sizeof(char));
|
output_full_path = malloc((strlen(output_full_folder) + strlen(filename) + 1) * sizeof(char));
|
||||||
snprintf(output_full_path, strlen(output_full_folder) + strlen(filename) + 1, "%s%s", output_full_folder,
|
snprintf(output_full_path, strlen(output_full_folder) + strlen(filename) + 1, "%s%s",
|
||||||
|
output_full_folder,
|
||||||
filename);
|
filename);
|
||||||
|
|
||||||
mkpath(output_full_folder);
|
mkpath(output_full_folder);
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
#include <caesium.h>
|
#include <caesium.h>
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -29,7 +27,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
start_compression(&options, &compress_options);
|
start_compression(&options, &compress_options);
|
||||||
|
|
||||||
//Cleanup the two memory allocated objects
|
//Cleanup the memory allocated objects
|
||||||
free(options.input_files);
|
free(options.input_files);
|
||||||
|
|
||||||
//Get the difference
|
//Get the difference
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include <caesium.h>
|
#include <caesium.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <ctype.h>
|
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "tinydir.h"
|
#include "tinydir.h"
|
||||||
|
@ -21,7 +20,6 @@ void print_help()
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
"\t-q, --quality\t\tset output file quality between [0-100], 0 for optimization\n"
|
"\t-q, --quality\t\tset output file quality between [0-100], 0 for optimization\n"
|
||||||
"\t-e, --exif\t\tkeeps EXIF info during compression\n"
|
"\t-e, --exif\t\tkeeps EXIF info during compression\n"
|
||||||
"\t-p, --progressive\t\toutputs a progressive JPEG\n"
|
|
||||||
"\t-o, --output\t\toutput folder\n"
|
"\t-o, --output\t\toutput folder\n"
|
||||||
"\t-R, --recursive\t\tif input is a folder, scan subfolders too\n"
|
"\t-R, --recursive\t\tif input is a folder, scan subfolders too\n"
|
||||||
"\t-S, --keep-structure\tkeep the folder structure, use with -R\n"
|
"\t-S, --keep-structure\tkeep the folder structure, use with -R\n"
|
||||||
|
@ -141,6 +139,10 @@ off_t get_file_size(const char *path)
|
||||||
|
|
||||||
char *get_human_size(off_t size)
|
char *get_human_size(off_t size)
|
||||||
{
|
{
|
||||||
|
if (size == 0) {
|
||||||
|
return "0.00 B";
|
||||||
|
}
|
||||||
|
|
||||||
//We should not get more than TB images
|
//We should not get more than TB images
|
||||||
char *unit[5] = {"B", "KB", "MB", "GB", "TB"};
|
char *unit[5] = {"B", "KB", "MB", "GB", "TB"};
|
||||||
//Index of the array containing the correct unit
|
//Index of the array containing the correct unit
|
||||||
|
|
Loading…
Reference in New Issue