Issue 1625 - Option for Windows-compatible filenames * trim trailing spaces and dots
This commit is contained in:
parent
76558d286a
commit
028826b7df
2 changed files with 17 additions and 2 deletions
|
@ -186,7 +186,9 @@
|
|||
<dd>If checked, whitespace characters (spaces and tabs) will be replaced with '-'.
|
||||
|
||||
<dt>Use Windows-compatible filenames
|
||||
<dd>If checked, special characters not supported by Windows like: <i>/ : \ < > | * ? ' "</i> will be replaced with '_'.
|
||||
<dd>If checked:<br>
|
||||
* special characters not supported by Windows like: <i>/ : \ < > | * ? ' "</i> will be replaced with '_'<br>
|
||||
* trailing spaces ' ' and dots '.' will be removed
|
||||
|
||||
</dl>
|
||||
Changes to any of these settings must be confirmed by pressing the 'Save configuration' button before taking effect.
|
||||
|
|
|
@ -151,7 +151,8 @@ cleanup_filename(char *s, dvr_config_t *cfg)
|
|||
if (s[0] == '.')
|
||||
s[0] = '_';
|
||||
|
||||
for (i = 0, len = strlen(s); i < len; i++) {
|
||||
int len2 = strlen(s);
|
||||
for (i = 0; i < len2; i++) {
|
||||
|
||||
if(s[i] == '/')
|
||||
s[i] = '-';
|
||||
|
@ -169,6 +170,18 @@ cleanup_filename(char *s, dvr_config_t *cfg)
|
|||
s[i] = '_';
|
||||
}
|
||||
|
||||
if(cfg->dvr_windows_compatible_filenames) {
|
||||
//trim trailing spaces and dots
|
||||
for (i = len2 - 1; i >= 0; i--) {
|
||||
if((s[i] == ' ') || (s[i] == '.')) {
|
||||
s[i] = '\0';
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue