[Amarok] fix: create .../scripts/ directory if it doesn't e

Mark Kretschmann kretschmann at kde.org
Wed Nov 4 06:27:27 CET 2009


On Tue, Nov 3, 2009 at 11:54 PM, Jakob Kummerow
<jakob.kummerow at gmail.com> wrote:
> commit 4a8039b53278b45ce5fcb2ee0dedd92d3586ef08
> Author:     Jakob Kummerow <jakob.kummerow at gmail.com>
> AuthorDate: Tue Nov 3 23:42:21 2009 +0100
> Commit:     Jakob Kummerow <jakob.kummerow at gmail.com>
> CommitDate: Tue Nov 3 23:42:21 2009 +0100
>
>    fix: create .../scripts/ directory if it doesn't exist
>
> diff --git a/src/dialogs/ScriptUpdater.cpp b/src/dialogs/ScriptUpdater.cpp
> index d69e8a5..445103c 100644
> --- a/src/dialogs/ScriptUpdater.cpp
> +++ b/src/dialogs/ScriptUpdater.cpp
> @@ -110,7 +110,7 @@ ScriptUpdater::phase2( KJob * job )
>     DEBUG_BLOCK
>     if ( job->error() )
>     {
> -        debug() << "job error! no version file found is most likely culprit";
> +        debug() << m_scriptname << ": job error! no version file found is most likely culprit";
>         // if no 'version' file was found, cancel the update
>         QTimer::singleShot( 0, this, SLOT( quit() ) );
>         return;
> @@ -233,6 +233,11 @@ ScriptUpdater::phase4( KJob * job )
>     QString relPath = KGlobal::dirs()->relativeLocation( "data", m_fileName );

This variable should be "const QString", unless it's being modified
later on. Also, please don't use cryptic names. Call it
"relativePath", then it will be easier to understand.

>     QFileInfo fileinfo( relPath );
>     QString destination = KGlobal::dirs()->saveLocation( "data", fileinfo.path(), false );
> +    QDir dir; // only needed as a dummy because .exists() and .mkpath() aren't static

This comment does not make sense. Either you use the object (which you
do), then it's not a dummy, or you don't. Whether the methods are
static is clearly visible from the API.

> +    if (!dir.exists(destination))
> +    {
> +        dir.mkpath(destination);
> +    }

Please respect our coding style conventions.


PS:
I'm being a little pedantic here because you're a new contributor.
Learning early makes it easier to break bad habits :)

-- 
Mark Kretschmann
Amarok Developer
www.kde.org - amarok.kde.org


More information about the Amarok-devel mailing list