chrismaltby / gb-studio

A quick and easy to use drag and drop retro game creator for your favourite handheld video game system
https://www.gbstudio.dev
MIT License
8.44k stars 467 forks source link

Leaving my system on sleep overnight results in an ENOENT / Cache folder error #1435

Open nielsderijk opened 3 months ago

nielsderijk commented 3 months ago

Describe the bug Previously, when I left my system sleep overnight, starting a build in the morning resulted in a Cache folder error (due to how Mac handles access to temp cache folders). The issue was easily fixed by restarting GB Studio.

Now, I need to close GB Studio and restart MacOS / my laptop to resolve the issue. A simple restart of the app does not help any more.

To Reproduce Steps to reproduce the behavior:

  1. Work on your game, press Save
  2. Continue in GB Studio the next day and try to build your game again
  3. THe ENOENT error shows

Expected behavior No errors when cache folder is not accessible. Or: if access to the same temp folder is required, a request for access?

Screenshots

Screenshot 2024-05-27 at 12 38 38

Platform (please complete the following information):

Additional context

chrismaltby commented 3 months ago

Weird I'd never come across as I've been using a Mac the entire time and rarely reboot this but looks like this doesn't happen when I run in dev mode, though I've just seen it happen with a production build of 3.1.0 that I happened to still have open.

After doing some research and following through the codepath that would cause that error to appear, I think it's actually a problem reading the files for GBDK and the other build tools out of the GB Studio's asar archive file rather than a problem writing to the tmp dir itself (I managed to get my affected app to modify files in the tmp directory fine even when this error showed). Unfortunately as it doesn't affect builds running in dev mode and it takes some time to occur I think this is going to be hard to debug and possibly might lead to the issue being in Electron. We're running an older version of Electron, so upgrading may fix the problem, but it's the last Electron that supports Windows 32-bit.

I'm going to make a custom build that includes lots of logging around this logic and leave it running for a few days to see what happens.

nielsderijk commented 3 months ago

Thanks for taking the time to look into this. Until the matter is resolved, Save & Quit will do!