pulsar-edit / ppm

Pulsar Package Manager
MIT License
35 stars 13 forks source link

src: Update default Pulsar install paths #49

Closed DeeDeeG closed 1 year ago

DeeDeeG commented 1 year ago

Changes:

Updates the default install paths for each OS, based on where our new bundled packages (made by electron-builder) install to.

Relatedly, adjust logic which finds the app on macOS, for the rebrand.


Notes:


Context:

This install path is used primarily to locate and read the editor's package.json, which gives various useful metadata for ppm to use, but also to find whatever files are needed from the editor bundle.

For example: this metadata is notably used to determine what Electron version to build native C/C++ code for, in whatever packages ppm is used to build.

(ppm reads the "electronVersion" field from Pulsar's package.json, which is located in Pulsar's "app.asar" bundle.) (See: src/command.coffee)

Pulsar's package.json is also read to get Pulsar's version number. (See: src/command.coffee, src/apm-cli.coffee)

It is also read to get the list of bundled packages in the editor. (See: src/install.coffee, src/list.coffee)

The install path is also used to find/load the src/compile-cache.js module from among the editor's own source files. (See: src/install.coffee)

Likewise, it is used to find/load the src/module-cache.js module from among the editor's own source files. (See: src/rebuild-module-cache.coffee)

DeeDeeG commented 1 year ago

I verified that the default install paths for Linux, macOS and Windows were as I adjusted them in this commit, as of December 22.

If it's changed since then, this PR is out of date. Might be after the recent macOS and Windows build metadata improvement PRs over at Pulsar?

EDIT: I think I need to check C:\Program Files\Pulsar now too, for system-wide installs, now that https://github.com/pulsar-edit/pulsar/pull/279 is merged in Pulsar core.

Note: I updated the macOS identifier from com.github.atom initially to com.pulsar-edit.pulsar for our app bundle, but after the macOS build improvement PR over at Pulsar core repo (https://github.com/pulsar-edit/pulsar/pull/280), I amended the commit to point to dev.pulsar-edit.pulsar starting properly with .dev.

DeeDeeG commented 1 year ago

Thanks for that fix, I tested it and it's working exactly as you wrote it, so I went ahead and committed it.

(Also, I went ahead and capitalized the /Pulsar for the per-user install based on what I saw for the suggested per-user install path on the latest Windows installer from master. Should have no effect per my testing, it works exactly the same with either capitalization or just lowercase, due to Windows being case-insensitive about paths/filenames. But just to note that the non-interactive 1.100.0-beta installer had installed itself per-user to .../pulsar (lowercase) and the new interactive installer from the latest master build I grabbed is suggesting to install to .../Pulsar (capitalized). But the real reason I did it is secretly so they would match and the code would look more pleasing to the eye. I guess maybe Windows Subsystem for Linux, or Bash shells, could somehow make this relevant??? But I think Node is setting the behavior here and it should be standardized that way? But, yeah. Just playing it safe. And making the code slightly more aesthetically nice, lol.)

(And thanks again for adding the system-wide install path! Was easier to just test what you wrote than to have to reverse-engineer it myself and be less confident when testing it.)

After that super long sidebar... This is ready for review again!

DeeDeeG commented 1 year ago

Thanks for the review, I confirmed the Windows installer shows these same paths, and I 'm not expecting the other OSes to have changed...

Merging. 🎉

EDIT: Just noting the tests pass for me on Linux, when rebased on master.