nojanath / SublimeKSP

Fork of Nils Liberg's SublimeKSP plugin. See README for details.
GNU General Public License v3.0
87 stars 18 forks source link

Playing sounds upon compilation doesn't work when sKSP runs from .sublime-package #343

Closed mkruselj closed 11 months ago

mkruselj commented 1 year ago

...because we're handing over actual filepaths that are residing inside the package, which normal Python os functions cannot read into. The sounds only play back when SublimeKSP is installed as an unmanaged (unpacked) package, for obvious reasons (the file magically becomes accessible!).

Potential options:

  1. Investigate using Sublime Text API sublime.load_binary_resource to see if we can play audio from memory. Test on all three supported operating systems.
  2. Investigate if we can play OS-specified sounds without packing any of our own inside the package. Test across all three OS (for Windows this is possible, not sure about Mac or Linux).
  3. Figure out if we can show the feature only if we're running as an unmanaged package (kinda meh but hey).
  4. Remove the feature (which would make me sadpanda but hey).
mkruselj commented 11 months ago

The solution turned out to be a sort of a mix of options 1 and 3: read the packaged WAV file that we have as binary resource using Sublime's API, then writing it out to the unmanaged packages folder and reading it from there at runtime!