[vlc-devel] [PATCH] convert.cpp: Added URI decoding to filepaths in batch conversion to eliminate file access output errors.

Rémi Denis-Courmont remi at remlab.net
Fri Jul 7 19:05:21 CEST 2017


Le tiistaina 4. heinäkuuta 2017, 17.15.12 EEST Theodore Brockman a écrit :
> Discovered that batch conversion resulted in no output files (and file
> access errors), whereas individual conversions of the same files worked
> perfectly. Upon examining the code it appears that individual files
> retrieve the file name via "fileLine->text();" which results in a properly
> formatted filename for whatever handles file conversions, whereas filenames
> are not initially properly formatted in the batch conversion case, which
> causes file output access errors when attempting batch conversions. ---
>  modules/gui/qt/dialogs/convert.cpp |  7 +++----
>  modules/gui/qt/util/qt_dirs.cpp    | 12 ++++++++++++
>  modules/gui/qt/util/qt_dirs.hpp    |  1 +
>  3 files changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/modules/gui/qt/dialogs/convert.cpp
> b/modules/gui/qt/dialogs/convert.cpp index 88aa8e3..900c454 100644
> --- a/modules/gui/qt/dialogs/convert.cpp
> +++ b/modules/gui/qt/dialogs/convert.cpp
> @@ -206,10 +206,8 @@ void ConvertDialog::close()
>              {
>                  QString fileExtension = ( ! profile->isEnabled() ) ? ".*" :
> "." + profile->getMux();
> 
> -                newFileName = incomingMRLs->at(i);
> -
> -                // Remove the file:// from the front of our MRL
> -                newFileName = newFileName.remove(0,7);
> +                // Decode URI of given MRL
> +                newFileName = fromURI(incomingMRLs->at(i));
> 
>                  // Remote the existing extention (if any)
>                  int extentionPos = newFileName.lastIndexOf('.');
> @@ -226,6 +224,7 @@ void ConvertDialog::close()
> 
>                  // Stick our new extention on
>                  newFileName = newFileName.append(fileExtension);
> +

???

>              }
> 
>              newFileName.replace( QChar('\''), "\\\'" );
> diff --git a/modules/gui/qt/util/qt_dirs.cpp
> b/modules/gui/qt/util/qt_dirs.cpp index b86b03d..2d0ff83 100644
> --- a/modules/gui/qt/util/qt_dirs.cpp
> +++ b/modules/gui/qt/util/qt_dirs.cpp
> @@ -39,3 +39,15 @@ QString toURI( const QString& s )
>      free( psz );
>      return uri;
>  }
> +
> +QString fromURI( const QString & s )
> +{
> +    char * decoded_uri = vlc_uri2path( qtu(s) );
> +    if( decoded_uri == NULL )
> +        return qfu("");
> +
> +    QString q_str = qfu( decoded_uri );
> +    free( decoded_uri );
> +    return q_str;
> +
> +}
> diff --git a/modules/gui/qt/util/qt_dirs.hpp
> b/modules/gui/qt/util/qt_dirs.hpp index 641ed4d..592b9f6 100644
> --- a/modules/gui/qt/util/qt_dirs.hpp
> +++ b/modules/gui/qt/util/qt_dirs.hpp
> @@ -49,4 +49,5 @@ static inline QString colon_unescape( QString s )
>  }
> 
>  QString toURI( const QString& s );
> +QString fromURI( const QString & s );
>  #endif

Could use separate patch,

-- 
雷米‧德尼-库尔蒙
https://www.remlab.net/



More information about the vlc-devel mailing list