This commit is contained in:
dgis 2019-02-04 19:24:19 +00:00
parent 0daad9e379
commit c2dbcf3931
3 changed files with 22 additions and 7 deletions

View file

@ -360,10 +360,20 @@ JNIEXPORT jint JNICALL Java_org_emulator_forty_eight_NativeLib_onFileNew(JNIEnv
_tcscpy(szChosenCurrentKml, filenameUTF8);
(*env)->ReleaseStringUTFChars(env, kmlFilename, filenameUTF8);
TCHAR * urlContentSchemeFound = _tcsstr(szChosenCurrentKml, _T("content://"));
// TCHAR * urlContentSchemeFound = _tcsstr(szChosenCurrentKml, _T("content://"));
// if(urlContentSchemeFound) {
// _tcscpy(szEmuDirectory, szChosenCurrentKml);
// TCHAR * filename = _tcsrchr(szChosenCurrentKml, _T('/'));
// if(filename) {
// *filename = _T('\0');
// }
// _tcscpy(szRomDirectory, szEmuDirectory);
TCHAR * fileScheme = _T("raw:");
TCHAR * urlContentSchemeFound = _tcsstr(szChosenCurrentKml, fileScheme);
if(urlContentSchemeFound) {
_tcscpy(szChosenCurrentKml, szChosenCurrentKml + 4 * sizeof(TCHAR));
_tcscpy(szEmuDirectory, szChosenCurrentKml);
TCHAR * filename = _tcsrchr(szChosenCurrentKml, _T('/'));
TCHAR * filename = _tcsrchr(szEmuDirectory, _T('/'));
if(filename) {
*filename = _T('\0');
}

View file

@ -558,7 +558,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
if(which == lastIndex) {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
//intent.setType("file/*");
intent.setType("*/*");
//intent.setType("*/*");
intent.setType("application/vnd.google-earth.kml+xml");
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
startActivityForResult(intent, INTENT_PICK_KML_FILE);
} else {
String kmlScriptFilename = kmlScripts.get(which).filename;

View file

@ -61,11 +61,14 @@ public class Utils {
Cursor cursor = context.getContentResolver().query(uri, null, null, null, null);
if (cursor.moveToFirst()) {
int idx = cursor.getColumnIndex(MediaStore.Files.FileColumns.DATA);
result = cursor.getString(idx);
try {
if (cursor != null && cursor.moveToFirst()) {
result = cursor.getString(0);
//result = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
}
} finally {
cursor.close();
}
cursor.close();
}
if (result == null)
result = url;