@@ -33,6 +33,8 @@ OptionsQmlModel::OptionsQmlModel(interfaces::Node& node)
33
33
m_prune_size_gb = m_prune ? PruneMiBtoGB (prune_value) : DEFAULT_PRUNE_TARGET_GB;
34
34
35
35
m_script_threads = SettingToInt (m_node.getPersistentSetting (" par" ), DEFAULT_SCRIPTCHECK_THREADS);
36
+
37
+ m_custom_datadir = false ;
36
38
}
37
39
38
40
void OptionsQmlModel::setDbcacheSizeMiB (int new_dbcache_size_mib)
@@ -130,10 +132,40 @@ QUrl OptionsQmlModel::getDefaultDataDirectory()
130
132
return QUrl::fromLocalFile (path);
131
133
}
132
134
133
- void OptionsQmlModel::setCustomDataDirArgs (QString path)
135
+ bool OptionsQmlModel::setCustomDataDirArgs (QString path)
134
136
{
135
137
if (!path.isEmpty ()) {
136
- // TODO: add actual custom data wiring
138
+ // TODO: add actual custom data wiring
139
+ #ifdef __ANDROID__
140
+ QString uri = path;
141
+ QString originalPrefix = " content://com.android.externalstorage.documents/tree/primary%3A" ;
142
+ QString newPrefix = " /storage/self/primary/" ;
143
+ QString path = uri.replace (originalPrefix, newPrefix);
144
+ #else
145
+ path = QUrl (path).toLocalFile ();
146
+ #endif // __ANDROID__
137
147
qDebug () << " PlaceHolder: Created data directory: " << path;
148
+
149
+ m_custom_datadir_string = path;
150
+ Q_EMIT customDataDirStringChanged (path);
151
+ m_custom_datadir = true ;
152
+ return true ;
153
+ }
154
+ return false ;
155
+ }
156
+
157
+ QString OptionsQmlModel::getCustomDataDirString ()
158
+ {
159
+ #ifdef __ANDROID__
160
+ m_custom_datadir_string = m_custom_datadir_string.replace (" content://com.android.externalstorage.documents/tree/primary%3A" , " /storage/self/primary/" );
161
+ #endif // __ANDROID__
162
+ return m_custom_datadir_string;
163
+ }
164
+
165
+ void OptionsQmlModel::setCustomDataDir (bool new_custom_datadir)
166
+ {
167
+ if (new_custom_datadir != m_custom_datadir) {
168
+ m_custom_datadir = new_custom_datadir;
169
+ Q_EMIT customDataDirChanged (new_custom_datadir);
138
170
}
139
- }
171
+ }
0 commit comments