Convert copied text files to DOS \r\n format relying on Perl's -T
While it may not be ideal here to rely on Perl's -T, since the `man perlfunc` says that -T uses heuristic, and maybe the better option would be to call `/usr/bin/file` and parse its output to see if such conversion is needed, this solution should be close enough.
This commit is contained in:
parent
3f0716c9f0
commit
ea04654b7f
1 changed files with 3 additions and 1 deletions
|
@ -108,8 +108,10 @@ sub ProcessDocumentDirectory($$$) {
|
|||
die("Something wrong, since file name is empty on $fullFilePath") unless defined $bareFileName and $bareFileName !~ /^\s*$/;
|
||||
my $fileName = $upiFull . '-' . $GROUP_NAMES_BY_DIR{$GROUP} . '-' . $bareFileName;
|
||||
my $copiedFile = catfile($numberedOutputDir, $fileName);
|
||||
copy($fullFilePath, catfile($numberedOutputDir, $fileName))
|
||||
copy($fullFilePath, $copiedFile)
|
||||
or die "unable to copy($fullFilePath, catfile($numberedOutputDir, $fileName))";
|
||||
system('/usr/bin/unix2dos', '-q', $copiedFile) if (-T $copiedFile);
|
||||
die "unable to copy $fullFilePath to $copiedFile" unless -f $copiedFile;
|
||||
} else {
|
||||
die("\"$fullFilePath\" is a strange file type, not handled!");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue