This commit is contained in:
parent
0daad9e379
commit
c2dbcf3931
3 changed files with 22 additions and 7 deletions
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -61,12 +61,15 @@ 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();
|
||||
}
|
||||
}
|
||||
if (result == null)
|
||||
result = url;
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue