samdze / playdate-nim

Nim bindings with extra features for the Playdate SDK
66 stars 3 forks source link

Use `projectName()` instead of static PDX name? #28

Closed paulstraw closed 1 year ago

paulstraw commented 1 year ago

👋 figured I'd start with some easy feedback. It's very possible I'm just missing something. Right now when I build, the output is a playdate.pdx. That means when I upload to device via the sim, other apps with that PDX name get overwritten.

It seems like this should be easy to change by updating the bundlePDX build proc to use projectName():

exec(pdcPath() & " --verbose -sdkpath " & sdkPath() & " source " & projectName())

This change seems to work well for me locally, but I'm not sure whether there's a specific reason it's set up like this, so I figured I'd open an issue instead of just PRing.

samdze commented 1 year ago

Ehy! Yes, using the project name for the final pdx would be ideal.

The issue with it lies in the VSCode launch config file. It currently has no way of figuring out the name of the pdx it has to launch when debugging, and I'd prefer not to require the user to edit it.

Maybe we can fix that using an .env file, but that would mean having to maintain two files containing the project name.

paulstraw commented 1 year ago

Oh, I honestly hadn't even seen the VSC launch file. That looks super useful! I'll pull that into my own code and see if I can figure out a solution for the name issue that doesn't involve a separate .env.

paulstraw commented 1 year ago

I messed around with this for a while locally. It seems like the easiest solution would be to make the bundlePDX change I originally mentioned, and update the launch.json to:

{
  // …
   "args": [
      "${workspaceFolder}/${workspaceFolderBasename}.pdx"
  ],
  // …
}

This assumes that the folder and my_project.nimble names match, but so far that seems like it's a fairly reasonable assumption. Happy to open a PR if you're alright with this direction.

samdze commented 1 year ago

Yeah seems reasonable enough. We could even do an extra step to be 100% sure the name will always match and also name the PDX the same as the project containing folder.