<table><tr><td style="">elvisangelaccio added a comment.
</td></tr></table><br /><div><div><p>The biggest problem is: how do we deal with non-existing archives? We use <tt style="background: #ebebeb; font-size: 13px;">Archive *Archive::create("non-existing-path")</tt> when we create a new archive (e.g. in <tt style="background: #ebebeb; font-size: 13px;">Part</tt> and <tt style="background: #ebebeb; font-size: 13px;">AddToArchive</tt>), but the goal is to make those <tt style="background: #ebebeb; font-size: 13px;">create()</tt> methods private.</p>

<p>We could add another wrapper job, e.g. <tt style="background: #ebebeb; font-size: 13px;">CreateJob *Archive::create(...)</tt> that internally calls <tt style="background: #ebebeb; font-size: 13px;">AddJob</tt>. In practice:</p>

<ol class="remarkup-list">
<li class="remarkup-list-item">If an archive already exists, we have an <tt style="background: #ebebeb; font-size: 13px;">Archive</tt> pointer and we can just call <tt style="background: #ebebeb; font-size: 13px;">Archive::addFiles()</tt> like we already do.</li>
<li class="remarkup-list-item">If we need to create a new archive, we do <tt style="background: #ebebeb; font-size: 13px;">auto createJob = Archive::create()</tt> and then, after the job is done, we retrieve the archive (<tt style="background: #ebebeb; font-size: 13px;">Archive *archive = createJob->archive();</tt>).</li>
</ol></div></div><br /><div><strong>TASK DETAIL</strong><div><a href="https://phabricator.kde.org/T3300" rel="noreferrer">https://phabricator.kde.org/T3300</a></div></div><br /><div><strong>EMAIL PREFERENCES</strong><div><a href="https://phabricator.kde.org/settings/panel/emailpreferences/" rel="noreferrer">https://phabricator.kde.org/settings/panel/emailpreferences/</a></div></div><br /><div><strong>To: </strong>elvisangelaccio<br /><strong>Cc: </strong>kde-utils-devel, elvisangelaccio, tctara<br /></div>