Commit 5530a3a5 authored by fallenstardust's avatar fallenstardust

fix文件已存在时覆盖空文件

parent c59b4627
...@@ -215,6 +215,9 @@ public class GameUriManager { ...@@ -215,6 +215,9 @@ public class GameUriManager {
try { try {
File yrp = new File(AppsSettings.get().getResourcePath() + "/" + CORE_REPLAY_PATH + "/" + urifile.getName().toLowerCase(Locale.US)); File yrp = new File(AppsSettings.get().getResourcePath() + "/" + CORE_REPLAY_PATH + "/" + urifile.getName().toLowerCase(Locale.US));
ParcelFileDescriptor pfd = getActivity().getContentResolver().openFileDescriptor(uri, "r"); ParcelFileDescriptor pfd = getActivity().getContentResolver().openFileDescriptor(uri, "r");
if (yrp.exists()) {
YGOStarter.startGame(getActivity(), null);
} else {
if (pfd == null) { if (pfd == null) {
return; return;
} else { } else {
...@@ -226,14 +229,15 @@ public class GameUriManager { ...@@ -226,14 +229,15 @@ public class GameUriManager {
pfd.close(); pfd.close();
} }
} }
}
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
} }
}
if (!ComponentUtils.isActivityRunning(activity, new ComponentName(activity, YGOMobileActivity.class))) { if (!ComponentUtils.isActivityRunning(activity, new ComponentName(activity, YGOMobileActivity.class))) {
YGOStarter.startGame(activity, null); YGOStarter.startGame(activity, null);
Toast.makeText(activity, activity.getString(R.string.yrp_installed), Toast.LENGTH_LONG).show(); Toast.makeText(activity, activity.getString(R.string.yrp_installed), Toast.LENGTH_LONG).show();
} }
}
} else { } else {
String host = uri.getHost(); String host = uri.getHost();
// if (!Constants.URI_HOST.equalsIgnoreCase(host)) { // if (!Constants.URI_HOST.equalsIgnoreCase(host)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment