Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Issue 1625 - Option for Windows-compatible filenames * trim trailing …
…spaces and dots
  • Loading branch information
dgolda authored and perexg committed Jan 12, 2015
1 parent 76558d2 commit 028826b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 3 additions & 1 deletion docs/html/config_dvr.html
Expand Up @@ -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.
Expand Down
15 changes: 14 additions & 1 deletion src/dvr/dvr_rec.c
Expand Up @@ -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] = '-';
Expand All @@ -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;
}

Expand Down

0 comments on commit 028826b

Please sign in to comment.