2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-11-29 05:20:23 +01:00

Remove OPEN_DOCUMENT_TREE request, because it's still does not gives permission to use fopen() call. So, forbid unwritable SD cards at all.

This commit is contained in:
Alibek Omarov (a1batross) 2017-04-01 00:52:13 +03:00
parent d216265519
commit 3b6365a048
3 changed files with 27 additions and 12 deletions

View File

@ -54,4 +54,17 @@
<string name="cancel">Отмена</string>
<string name="no_updates">Обновления не найдены</string>
<string name="checking_updates">Работаю...</string>
<string name="immersive_mode">Включить Immersive Mode(Полноэкранный режим, для KitKat и старше)</string>
<string name="write_failed">Тест чтения не удался</string>
<string name="ask_about_new_basedir_msg">Переместите файлы игры куда-нибудь ещё. Например, в Android/data/in.celest.xash3d.hl или во внутренюю память. На следующий запуск я снова спрошу местоположение файлов игры.</string>
<!-- <string name="lollipop_select_folder_btn">Select folder</string> -->
<!-- These strings must be concat with a "ask_about_new_basedir" string -->
<string name="lollipop_request_permission_fail_msg">Тест записи не удался дважды. </string>
<string name="lollipop_write_fail_msg">Из-за политик записи в новых версиях Android, полноценно воспользоваться внешней памятью невозможно. </string>
<string name="kitkat_write_fail_msg">Из-за политик записи Android 4.4, вы не можете воспользоваться внешней памятью. </string>
<string name="readonly_fs_fail_msg">Похоже, ваша файловая система в режиме только для чтения. </string>
</resources>

View File

@ -3,7 +3,7 @@
<string name="app_name" translatable="false">Xash3D</string>
<string name="launcher_name" translatable="false">Xash3D</string>
<string name="launcher_name_test" translatable="false">Xash3D (test)</string>
<string name="version_string" translatable="false">v0.18</string>
<string name="version_string" translatable="false">v0.19</string>
<string name="launch_button">Launch Xash3D!</string>
<string name="cmd_args_text">Command line arguments(experts only)</string>
@ -62,11 +62,12 @@
<string name="write_failed">Write test has failed</string>
<string name="ask_about_new_basedir_msg">Move your game files somewhere else, for example Android/data/in.celest.xash3d.hl or internal memory. At next run I will ask you about folder again.</string>
<string name="lollipop_request_permission_msg">Due to writing politics of newer Android versions, you need to select a root folder of storage where game data is located.</string>
<string name="lollipop_select_folder_btn">Select folder</string>
<!--<string name="lollipop_request_permission_msg">Due to writing politics of newer Android versions, you need to select a root folder of storage where game data is located.</string>
<string name="lollipop_select_folder_btn">Select folder</string>-->
<!-- These strings must be concat with a "ask_about_new_basedir" string -->
<string name="lollipop_request_permission_fail_msg">Write test has been failed twice. </string>
<string name="lollipop_write_fail_msg">Due to writing politics of newer Android versions, you can\'t use this storage. </string>
<string name="kitkat_write_fail_msg">Due to writing politics of Android 4.4, you can\'t use this storage. </string>
<string name="readonly_fs_fail_msg">Seems you have read-only filesystem. </string>
</resources>

View File

@ -173,7 +173,7 @@ public class XashActivity extends Activity {
String basedir = mPref.getString( "basedir", "/sdcard/xash/" );
checkWritePermission( basedir );
}
else if( mReturingWithResultCode == OPEN_DOCUMENT_TREE_RESULT )
/*else if( mReturingWithResultCode == OPEN_DOCUMENT_TREE_RESULT )
{
String basedir = getStringExtraFromIntent( getIntent(), "basedir", mPref.getString("basedir","/sdcard/xash/"));
Log.v(TAG, "Got permissions. Checking writing again...");
@ -202,7 +202,7 @@ public class XashActivity extends Activity {
{
launchSurfaceAndEngine();
}
}
}*/
mReturingWithResultCode = 0;
}
@ -320,18 +320,19 @@ public class XashActivity extends Activity {
if( sdk > 20 )
{
// OPEN_DOCUMENT_TREE
// 5.0 and higher _allows_ writing to SD card, but have broken fopen() call. So, no Xash here. F*ck you, Google!
String msg = getString(R.string.lollipop_write_fail_msg) + getString(R.string.ask_about_new_basedir_msg);
// first try
new AlertDialog.Builder(this)
.setTitle( R.string.write_failed )
.setMessage( R.string.lollipop_request_permission_msg )
.setPositiveButton( R.string.lollipop_select_folder_btn, new DialogInterface.OnClickListener()
.setMessage( msg )
.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int whichButton)
{
Intent intent = new Intent("android.intent.action.OPEN_DOCUMENT_TREE");
XashActivity.this.startActivityForResult(intent, OPEN_DOCUMENT_TREE_RESULT);
XashActivity act = XashActivity.this;
act.setFolderAsk( true );
act.finish();
}
})
.setCancelable(false)