mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Android: go back to using Qt's DataLocation
It appears that the default path we tried to use on Android since commit
80056278f7 ("android.cpp: update path retriaval scheme") didn't work -
so let's just go back to what we used to do as that was perfectly fine.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
			
			
This commit is contained in:
		
							parent
							
								
									787b12cff4
								
							
						
					
					
						commit
						aaac2cbe9c
					
				
					 1 changed files with 4 additions and 10 deletions
				
			
		| 
						 | 
					@ -44,18 +44,12 @@ void subsurface_user_info(struct user_info *user)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const char *system_default_path_append(const char *append)
 | 
					static const char *system_default_path_append(const char *append)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	/* Replace this when QtCore/QStandardPaths getExternalStorageDirectory landed */
 | 
						// Qt appears to find a working path for us - let's just go with that
 | 
				
			||||||
	QAndroidJniObject externalStorage = QAndroidJniObject::callStaticObjectMethod("android/os/Environment", "getExternalStorageDirectory", "()Ljava/io/File;");
 | 
						QString path = QStandardPaths::standardLocations(QStandardPaths::DataLocation).first();
 | 
				
			||||||
	QAndroidJniObject externalStorageAbsolute = externalStorage.callObjectMethod("getAbsolutePath", "()Ljava/lang/String;");
 | 
					
 | 
				
			||||||
	QString path = externalStorageAbsolute.toString();
 | 
					 | 
				
			||||||
	QAndroidJniEnvironment env;
 | 
					 | 
				
			||||||
	if (env->ExceptionCheck()) {
 | 
					 | 
				
			||||||
		// FIXME: Handle exception here.
 | 
					 | 
				
			||||||
		env->ExceptionClear();
 | 
					 | 
				
			||||||
		path = QString("/sdcard");
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if (append)
 | 
						if (append)
 | 
				
			||||||
		path += QString("/%1").arg(append);
 | 
							path += QString("/%1").arg(append);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return strdup(path.toUtf8().data());
 | 
						return strdup(path.toUtf8().data());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue