File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -130,10 +130,32 @@ QUrl OptionsQmlModel::getDefaultDataDirectory()
130
130
return QUrl::fromLocalFile (path);
131
131
}
132
132
133
- void OptionsQmlModel::setCustomDataDirArgs (QString path)
133
+ QString OptionsQmlModel::setCustomDataDirArgs (QString path)
134
134
{
135
135
if (!path.isEmpty ()) {
136
136
// TODO: add actual custom data wiring
137
+ #ifdef __ANDROID__
138
+ QString uri = path;
139
+ QString originalPrefix = " content://com.android.externalstorage.documents/tree/primary%3A" ;
140
+ QString newPrefix = " /storage/self/primary/" ;
141
+ QString path = uri.replace (originalPrefix, newPrefix);
142
+ #else
143
+ path = QUrl (path).toLocalFile ();
144
+ #endif // __ANDROID__
137
145
qDebug () << " PlaceHolder: Created data directory: " << path;
146
+
147
+ Q_EMIT customDataDirStringChanged (path);
148
+ return path;
138
149
}
150
+ return QString ();
151
+ }
152
+
153
+ QString OptionsQmlModel::getCustomDataDirString ()
154
+ {
155
+ #ifdef __ANDROID__
156
+ m_custom_datadir_string = m_custom_datadir_string.replace (" content://com.android.externalstorage.documents/tree/primary%3A" , " /storage/self/primary/" );
157
+ #else
158
+ m_custom_datadir_string = QUrl (m_custom_datadir_string).toLocalFile ();
159
+ #endif // __ANDROID__
160
+ return m_custom_datadir_string;
139
161
}
Original file line number Diff line number Diff line change @@ -62,7 +62,8 @@ class OptionsQmlModel : public QObject
62
62
void setUpnp (bool new_upnp);
63
63
QString getDefaultDataDirString ();
64
64
QUrl getDefaultDataDirectory ();
65
- Q_INVOKABLE void setCustomDataDirArgs (QString path);
65
+ Q_INVOKABLE QString setCustomDataDirArgs (QString path);
66
+ Q_INVOKABLE QString getCustomDataDirString ();
66
67
67
68
public Q_SLOTS:
68
69
void setCustomDataDirString (const QString &new_custom_datadir_string) {
You can’t perform that action at this time.
0 commit comments