Simulator starting twice.

While working on my project on OSX, after a code save or restart (cmd-R), the Solar2D simulator runs twice every time. It starts, then re-starts, usually in less than 1 or 2 seconds. I am using DropBox for file storage so I can work from several machines, but this problem just started and was not occurring in 2021-22 for example (on OSX and using DropBox).

I was reading on the forums this problem was occurring back in '13-'14, and was due to a debugger call named Glider. My project does not contain Glider.

Any suggestions?

Thank you.

Maybe a file gets re-created at some point in the project folder?
A possible workaround might be using a timer inside main.lua, to wait a fraction of a second before loading the first module.

(I disabled automatic-relaunch on simulator)

Thank you for the reply. I think you’re right about the file system delay may be causing the simulator to double launch. A timer may work, but a bit of a hack. Disabling auto-launch on project mod does make a difference but of course I lose the convenience and must perform the relaunch each time instead.

Strange that it never did this until some recent builds…

It took me weeks to understand that “the game is not going to be re-launched automatically”, and sometimes I still freeze in front of the screen for a couple of seconds :sweat_smile:

Anyway shortcuts come in handy! such win+R from the simulator and f10 from my code editor.

I even though about creating a routine that re-launch the sim when a file is changed and last sim launch occurred more than X seconds ago… But I don’t need it that much at the moment.

I find pressing Ctrl+R to restart the simulator to be much more convenient than the auto restart, but then again, I have a terrible habit of clicking Ctrl+S in whatever code editor I’m using after every minor change, which resulted in lots of crashes in my early days of using Solar2D. :smiley:

2 Likes

If I move my project from Dropbox to my local drive the simulator does not start twice, so it must be a syncing issue that is causing the double start. Like I said, the last major project I worked on the simulator did not do this, but I still don’t know who to point the finger at.

@Il.Sui, I tried adding a timer, but it did not help - the simulator started twice, but with whatever delay I programmed in.

Does Dropbox create some kind of history or other self-generated files locally?

I’m thinking about GitHub. It has some files to control the repo, so if you set-up the project folder as repo you fall in this:

You save a file -> the sim gets restarted 
GitHub updates a file inside the project -> the sim starts again 

That’s why my folders structure is:

C:/Projects/<my repo>/<my Solar2d project>

Basically I don’t have GitHub files inside my Solar2d project.

Can you relate with this stuff someway?

I’m not using Dropbox and iCloud sync code (using Git), but presumably it was the file modification time change that triggered the restart, so please check if Dropbox has the appropriate setting to keep the local modification time?

BTW, macOS Solar2D Simulator relaunch will ignore folders Library/, System/, .Trash/, and files filename starts with ., .bak, .tmp, .orig.