<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!-- 2022-11-14 Mon 15:40 --><meta http-equiv="Content-Type" content="text/html;charset=utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><meta name="generator" content="Org Mode"/></head><body>
<div style="font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";;font-size:11pt;line-height:12pt;" id="content">
<p style="text-decoration:none;line-height:1.4;margin-top:10px;margin-bottom:0px;font-size:11pt;max-width:50em;">
Hello everyone!
</p>
<p style="text-decoration:none;line-height:1.4;margin-top:10px;margin-bottom:0px;font-size:11pt;max-width:50em;">
I recently learned that <code style="font-size:11pt;font-family:SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;;background:#f9f9f9;">cf3f1d162f8f2a53be7791906f435d8c0501247d</code> broke a
couple of things on Android (my fault to not be careful when an MR was created).
But fortunately, this doesn’t happen for most users (since bugs only surface
once you change the resource location).
</p>
<p style="text-decoration:none;line-height:1.4;margin-top:10px;margin-bottom:0px;font-size:11pt;max-width:50em;">
There are a couple of bugs that I want to discuss, one during the meeting and
one over the mailing list to get a proper opinion about this.
</p>
<p style="text-decoration:none;line-height:1.4;margin-top:10px;margin-bottom:0px;font-size:11pt;max-width:50em;">
<b style="font-weight:500;color:#c01c28;">The Bug</b>:
</p>
<p style="text-decoration:none;line-height:1.4;margin-top:10px;margin-bottom:0px;font-size:11pt;max-width:50em;">
One of the bug we have is, when the user changes resource location and restarts
Krita. The resource paths that use <code style="font-size:11pt;font-family:SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;;background:#f9f9f9;">KoResourcePaths::cleanup()</code> in its code
paths don’t get installed. Reason being cleanup is supposed to skip the resource
paths that start with default path (<code style="font-size:11pt;font-family:SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;;background:#f9f9f9;">QStandardPaths::AppDataLocation</code>) but if
and only if the user resource path has been changed.
</p>
<p style="text-decoration:none;line-height:1.4;margin-top:10px;margin-bottom:0px;font-size:11pt;max-width:50em;">
Now on Android, the default resource location points to something like this:
</p>
<p style="text-decoration:none;line-height:1.4;margin-top:10px;margin-bottom:0px;font-size:11pt;max-width:50em;">
<code style="font-size:11pt;font-family:SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;;background:#f9f9f9;">/storage/self/primary/Android/data/org.krita/files</code> – which is good. But the
install location points to
<code style="font-size:11pt;font-family:SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;;background:#f9f9f9;">/storage/self/primary/Android/data/org.krita/files/share</code> which if we look at
the logic of cleanup gets skipped because of the <code style="font-size:11pt;font-family:SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;;background:#f9f9f9;">startsWith</code> clause.
</p>
<div style="margin-top:10px;font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";;font-size:11pt;line-height:12pt;">
<pre style="line-height:1.2;color:#ffffff;background-color:#000000;margin:4px 0px 8px 0px;padding:8px 12px;width:max-content;min-width:50em;border-radius:5px;font-size:0.9em;font-weight:500;font-family:SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;;"><span style="color: #b6a0ff; font-weight: bold;">static</span> <span style="color: #6ae4b9; font-weight: bold;">QStringList</span> <span style="color: #feacd0;">cleanup</span><span style="color: #ffffff; background-color: #000000;">(</span><span style="color: #b6a0ff; font-weight: bold;">const</span> <span style="color: #6ae4b9; font-weight: bold;">QStringList</span> <span style="color: #b6a0ff; font-weight: bold;">&</span><span style="color: #00d3d0;">pathList</span><span style="color: #ffffff; background-color: #000000;">)</span>
<span style="color: #ffffff; background-color: #000000;">{</span>
<span style="font-weight: bold;">// [...]</span>
<span style="color: #b6a0ff; font-weight: bold;">const</span> <span style="color: #6ae4b9; font-weight: bold;">QString</span> <span style="color: #00d3d0;">writableLocation</span> <span style="color: #b6a0ff; font-weight: bold;">=</span> <span style="color: #6ae4b9; font-weight: bold;">QStandardPaths</span>::<span style="color: #feacd0;">writableLocation</span><span style="color: #ff62d4; background-color: #000000;">(</span><span style="color: #6ae4b9; font-weight: bold;">QStandardPaths</span>::AppDataLocation<span style="color: #ff62d4; background-color: #000000;">)</span><span style="color: #ffffff; background-color: #000000;">;</span>
<span style="font-weight: bold;">// [...]</span>
<span style="font-weight: bold;">// v HERE</span>
<span style="color: #b6a0ff; font-weight: bold;">if</span> <span style="color: #ff62d4; background-color: #000000;">(</span>getRidOfAppDataLocation <span style="color: #b6a0ff; font-weight: bold;">&&</span> cleanPath<span style="color: #ffffff; background-color: #000000;">.</span><span style="color: #feacd0; font-style: italic;">startsWith</span><span style="color: #3fdfd0; background-color: #000000;">(</span>writableLocation<span style="color: #3fdfd0; background-color: #000000;">)</span><span style="color: #ff62d4; background-color: #000000;">)</span> <span style="color: #ff62d4; background-color: #000000;">{</span>
<span style="color: #b6a0ff; font-weight: bold;">continue</span><span style="color: #ffffff; background-color: #000000;">;</span>
<span style="color: #ff62d4; background-color: #000000;">}</span>
cleanedPathList <span style="color: #b6a0ff; font-weight: bold;"><<</span> cleanPath<span style="color: #ffffff; background-color: #000000;">;</span>
<span style="color: #ffffff; background-color: #000000;">}</span>
<span style="color: #b6a0ff; font-weight: bold;">return</span> cleanedPathList<span style="color: #ffffff; background-color: #000000;">;</span>
<span style="color: #ffb9ab; background-color: #77002a; font-weight: bold;">}</span>
</pre>
</div>
<p style="text-decoration:none;line-height:1.4;margin-top:10px;margin-bottom:0px;font-size:11pt;max-width:50em;">
Resulting in resources not getting installed… <b style="font-weight:500;color:#c01c28;">So my question is</b>, if we change
the “Install Location” to an inaccessible location [1] what would the
consequences be?
</p>
<p style="text-decoration:none;line-height:1.4;margin-top:10px;margin-bottom:0px;font-size:11pt;max-width:50em;">
The other option is to create different directories in
<code style="font-size:11pt;font-family:SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;;background:#f9f9f9;">/storage/self/primary/Android/data/org.krita/files</code> for install and the user
config. But since the user-config gets installed in <code style="font-size:11pt;font-family:SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;;background:#f9f9f9;">files/</code> itself we may have
a problem where user would lose their configs (unless we also provide a way to
move the resources to the new location in this particular case).
</p>
<p style="text-decoration:none;line-height:1.4;margin-top:10px;margin-bottom:0px;font-size:11pt;max-width:50em;">
Deciding which one would solely depend on if there is a use-case to having
Install Location be an accessible location? Is there any?
</p>
<p style="text-decoration:none;line-height:1.4;margin-top:10px;margin-bottom:0px;font-size:11pt;max-width:50em;">
[1]: This path is something which user wouldn’t be able to view or copy or
access from external apps. This path can only be seen by Krita and will be setup
when the app is installed/updated.
</p>
</div>
</body></html>