[PATCH] Use File::Spec functions for programme/thumbnail file paths

dinkypumpkin dinkypumpkin at gmail.com
Sat May 14 12:06:44 EDT 2011


First of all: you probably don't need this patch.  This is an obscure thing that only pertains to Windows users who employ custom user commands to post-process get_iplayer downloads, and only if those user commands use certain Windows system commands (e.g., COPY).  I would guess those qualifications will result in a vanishingly small user base.  I came across this problem when working on new tagging code (posted elsewhere).  Since the problem addressed by this change isn't related to tagging per se, I've posted it separately, just in case.  

As for substance, this patch fixes a problem that cropped up after moving to File::Spec->rel2abs() in order to fix a different bug related to creation of output directories on Windows.  Since rel2abs returns paths using native directory separators, it lead to downloaded file paths containing mixed directory separators (since get_iplayer uses the UNIX-style forward slash internally).  Perl can deal with mixed separators, but COPY et al. cannot.  With this patch, all file paths that are part of the generic metadata (and thus might be expanded and passed to user commands) are formulated with File::Spec functions and thus will always contain OS-appropriate directory separators.

This change has been incorporated into my get_iplayer fork.  Instructions here:

https://github.com/dinkypumpkin/get_iplayer/wiki/instructions

Commit message follows, patch is attached.

This change ensures that file paths used in substitution
parameters (<filename>, <filepart>, <thumbfile>) are:
a) created in an OS-independent manner; b) not sent through
normal escaping when expanded (since they should now contain
only safe characters).  This is primarily for the benefit of
Windows/DOS system commands (e.g., COPY) that may be confused
by mixed or escaped directory separators in a file path when
employed as part of a user command.  Calls to File::Spec
functions are fully-qualified because File::Spec::Functions
is not available in Windows installer version of get_iplayer.
---
 get_iplayer |   37 +++++++++++++++++++++++--------------
 1 files changed, 23 insertions(+), 14 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0009-Use-File-Spec-functions-for-programme-thumbnail-file.patch
Type: text/x-patch
Size: 5216 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/get_iplayer/attachments/20110514/2571f613/attachment.bin>


More information about the get_iplayer mailing list