Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use SDL_DropEvent to retrieve file path on Android #1672

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Closed

Use SDL_DropEvent to retrieve file path on Android #1672

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.1
Reported for operating system, platform: Android (All), All

Comments on the original bug report:

On 2014-10-22 13:43:50 +0000, wrote:

Created attachment 1911
SDL Activity.java: I added a method named "onNativeDropFile" and call at the end of "onCreate" method. | SDL_android.c: I added the native function "Java_org_libsdl_app_SDLActivity_onNativeDropFile".

When we open file into a SDL application with another application using "Open with" command, we don't have any way to retrieve the file path pass as argument. We could manage this into the Activity that extends from SDLActivity, but, for me, it's the work of SDL to manage that.

On iOS, into the file SDL_uikitappdelegate.m, we can see (line 275) that it uses SDL_SendDropFile function to trigger an SDL_DropEvent with the filename.

I would like the same behaviour for Android, so I updated the SDL source code (default branch, rev. 9176) to allow that.

On 2014-10-22 14:27:19 +0000, wrote:

Created attachment 1912
Patch.

On 2014-10-24 09:09:40 +0000, Philipp Wiesemann wrote:

Thank you for working on an implementation.

There is small fault in the patch because getPath() may return null for invalid URIs. [1] This may lead to a crash at least in SDL_SendDropFile() at SDL_strdup().

[1] http://developer.android.com/reference/android/net/Uri.html#getPath%28%29

On 2015-02-19 05:22:19 +0000, Ryan C. Gordon wrote:

Marking a large number of bugs with the "triage-2.0.4" keyword at once. Sorry if you got a lot of email from this. This is to help me sort through some bugs in regards to a 2.0.4 release. We may or may not fix this bug for 2.0.4, though!

On 2015-04-07 04:57:57 +0000, Ryan C. Gordon wrote:

(sorry if you get a lot of copies of this email, I'm marking several bugs at once)

Marking bugs for the (mostly) final 2.0.4 TODO list. This means we're hoping to resolve this bug before 2.0.4 ships if possible. In a perfect world, the open bug count with the target-2.0.4 keyword is zero when we ship.

(Note that closing a bug report as WONTFIX, INVALID or WORKSFORME might still happen.)

--ryan.

On 2015-05-27 00:37:49 +0000, Ryan C. Gordon wrote:

I added the null check that Philipp requested and put this patch in revision control as https://hg.libsdl.org/SDL/rev/d86771e28c51 ...thanks!

--ryan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant