love2d / love-android

Android build setup for LÖVE.
https://love2d.org
Other
200 stars 70 forks source link

Running through the LÖVE Loader seems to get a fresh save dir each time #257

Closed akkartik closed 8 months ago

akkartik commented 9 months ago

I have an app that saves some settings across restart in the save dir. It doesn't persist such settings when run from the LÖVE loader. But it does so when run from the browser download window. Does this seem expected?

MikuAuahDark commented 9 months ago

I tried this simple code:

function love.draw()
    love.graphics.print(love.filesystem.getSaveDirectory(), 10, 10)
end

And I can see in my case the save directory is stays the same. Try that one out and see if the save directory differs on every invocation.

akkartik commented 9 months ago

Yeah you're right, the directory doesn't change. Let me dig a little further. I wonder if the directory is getting cleared between invocations.

akkartik commented 9 months ago

Looks like love.filesystem.write is failing for me. The following program shows me a file being created on desktop but not on Android.

function love.load()
  Info = love.filesystem.getInfo('config')
  love.filesystem.write('config', 'abc')
  Info2 = love.filesystem.getInfo('config')
end

function love.draw()
  love.graphics.print(tostring(Info), 10,10)
  love.graphics.print(tostring(Info2), 10,40)
end
akkartik commented 9 months ago

Yes, I see an error when running from the Loader.

function love.load()
  Info = love.filesystem.getInfo('config')
  Status, Err = love.filesystem.write('config', 'abc')
  Info2 = love.filesystem.getInfo('config')
end

function love.draw()
  love.graphics.print(tostring(Info), 10,10)
  love.graphics.print(tostring(Status)..'/'..tostring(Err), 10,40)
  love.graphics.print(tostring(Info2), 10,70)
end

This prints:

Could not set write directory.
akkartik commented 8 months ago

Thank you!

I'm having some trouble trying out the artifact:

App not installed as package appears to be invalid.

I tried multiple browsers, with and without nightly.link.

MikuAuahDark commented 8 months ago

APK installs fine in here, both in my phone and Android 5 emulator. Make sure to extract the APK inside the zip artifact.

akkartik commented 8 months ago

Yes, I confirmed that. Steps I was following were to unzip and then try to install the .apk inside the zip file.

I've also confirmed that it's not some detail about which app is doing the installation:

Baseline: If I download https://github.com/love2d/love/releases/download/11.5/love-11.5-android.apk from the https://love2d.org/ frontpage to my own server, then download it from my server to my phone using Firefox and install it, everything works fine :heavy_check_mark:

However, if I download love-android.apk from https://github.com/love2d/love-android/actions/runs/7306340688, then unzip it and publish the .apk inside to my own server, then download it from my server to my phone using Firefox and install it, I get the above error :heavy_multiplication_x: (This approach doesn't require me to go through the file manager app on my phone.)

akkartik commented 8 months ago

I can also reproduce the problem on my tablet.

I'll keep an eye on newer artifacts. If I recall correctly I've seen this problem before, but I am sometimes able to install artifacts.

BTW, I notice the v12 branch artifact has expired. I'm going to keep an eye out for a new artifact on that branch and test it out as well.

MikuAuahDark commented 8 months ago

But have you uninstalled previous LOVE app? Sadly the only way to get detailed error is to use ADB to install it.

akkartik commented 8 months ago

Thank you very much for the hotfix release. Yes, I was uninstalling LÖVE each time. But I was able to get it installed now from https://love2d.org

MikuAuahDark commented 8 months ago

Oh interesting, because that APK comes from GitHub Actions too. The only difference is it's signed with LOVE Android keystore instead of debug keystore.