/ bugfix
This commit is contained in:
parent
67d1d3e853
commit
e1a6c862a2
|
@ -0,0 +1,29 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<Objective-C-extensions>
|
||||
<file>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
|
||||
</file>
|
||||
<class>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
|
||||
</class>
|
||||
<extensions>
|
||||
<pair source="cpp" header="h" fileNamingConvention="NONE" />
|
||||
<pair source="c" header="h" fileNamingConvention="NONE" />
|
||||
</extensions>
|
||||
</Objective-C-extensions>
|
||||
</code_scheme>
|
||||
</component>
|
|
@ -13,7 +13,7 @@
|
|||
----------
|
||||
|
||||
###### TESTED PLATFORMS
|
||||
* Mac OS X Sierra (v10.13.0)
|
||||
* Mac OS X High Sierra (v10.13.1)
|
||||
* Ubuntu 16.04
|
||||
* Windows 10
|
||||
|
||||
|
@ -60,6 +60,7 @@ $ caesiumclt -q 0 -RS -o ~/output/ ~/Pictures
|
|||
----------
|
||||
|
||||
###### CHANGELOG
|
||||
* 0.11.0-beta - Fixing paths issues and dry-run option
|
||||
* 0.10.2-beta - Bugfixes & full Windows support
|
||||
* 0.10.1-beta - All features are available
|
||||
* 0.10.0-beta - Switched to cmake build system and libcaesium
|
||||
|
|
24
src/helper.c
24
src/helper.c
|
@ -1,9 +1,11 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#endif
|
||||
|
||||
#include "helper.h"
|
||||
#include "optparse.h"
|
||||
#include "utils.h"
|
||||
|
@ -47,11 +49,13 @@ cclt_options parse_arguments(char **argv, cs_image_pars *options)
|
|||
} else {
|
||||
realpath(opts.optarg, parameters.output_folder);
|
||||
}
|
||||
if (parameters.output_folder[strlen(opts.optarg) - 1] != '/' && parameters.output_folder[strlen(opts.optarg) - 1] != '\\') {
|
||||
if (parameters.output_folder[strlen(opts.optarg) - 1] != '/' &&
|
||||
parameters.output_folder[strlen(opts.optarg) - 1] != '\\') {
|
||||
#ifdef _WIN32
|
||||
snprintf(parameters.output_folder, strlen(parameters.output_folder) + 2, "%s\\", parameters.output_folder);
|
||||
#else
|
||||
snprintf(parameters.output_folder, strlen(parameters.output_folder) + 2, "%s/", parameters.output_folder);
|
||||
snprintf(parameters.output_folder, strlen(parameters.output_folder) + 2, "%s/",
|
||||
parameters.output_folder);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
@ -103,6 +107,16 @@ cclt_options parse_arguments(char **argv, cs_image_pars *options)
|
|||
if (is_directory(resolved_path)) {
|
||||
if (!files_flag) {
|
||||
folders_flag = true;
|
||||
|
||||
if (resolved_path[strlen(resolved_path) - 1] != '/' && resolved_path[strlen(resolved_path) - 1] != '\\') {
|
||||
#ifdef _WIN32
|
||||
resolved_path[strlen(resolved_path)] = '\\';
|
||||
#else
|
||||
resolved_path[strlen(resolved_path)] = '/';
|
||||
#endif
|
||||
resolved_path[strlen(resolved_path)] = '\0';
|
||||
}
|
||||
|
||||
snprintf(parameters.input_folder, strlen(resolved_path) + 1, "%s", resolved_path);
|
||||
int count = 0;
|
||||
count = scan_folder(resolved_path, ¶meters, parameters.recursive);
|
||||
|
@ -122,10 +136,12 @@ cclt_options parse_arguments(char **argv, cs_image_pars *options)
|
|||
}
|
||||
|
||||
//Check if the output folder is a subfolder of the input to avoid infinite loops
|
||||
//but just if the -R option is set
|
||||
//However, if the folders are the same, we can let it go as it will overwrite the files
|
||||
if (folders_flag) {
|
||||
if (strstr(parameters.output_folder, parameters.input_folder) != NULL
|
||||
&& strcmp(parameters.output_folder, parameters.input_folder) != 0) {
|
||||
&& strcmp(parameters.output_folder, parameters.input_folder) != 0
|
||||
&& parameters.recursive) {
|
||||
display_error(ERROR, 12);
|
||||
}
|
||||
}
|
||||
|
@ -171,7 +187,7 @@ int start_compression(cclt_options *options, cs_image_pars *parameters)
|
|||
options->output_folder, filename);
|
||||
} else {
|
||||
/*
|
||||
* Otherwise, we nee to compute the whole directory structure
|
||||
* Otherwise, we need to compute the whole directory structure
|
||||
* We are sure we have a folder only as input, so that's the root
|
||||
* Just compute the subfolders without the filename, make them and append the filename
|
||||
* A piece of cake <3
|
||||
|
|
Loading…
Reference in New Issue