HISE Logo Forum
    • Categories
    • Register
    • Login

    [bug] Encrypted expansions magically turning into file based

    Scheduled Pinned Locked Moved Bug Reports
    expansionencryptedfile based
    16 Posts 2 Posters 630 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • d.healeyD
      d.healey
      last edited by d.healey

      I've managed to capture the transformation in action :)

      It occurs when deleting the expansion's files while HISE (or the plugin) is running. In a real world scenario this happens when the user clicks my uninstall expansion button.

      If the expansion folder is left behind (which I do when the user wants to preserve their presets after uninstallation) then an expansion_info.xml file is generated automatically when HISE is closed.

      The next time HISE is opened it auto-creates the folder structure for a file based expansion and this causes mucho problemo!

      Here's a video showing it happening in realtime.

      https://filedn.eu/larUQgXOwVjQdvpPaD96lHH/encrypted expansion to file based.mp4

      Libre Wave - Freedom respecting instruments and effects
      My Patreon - HISE tutorials
      YouTube Channel - Public HISE tutorials

      Christoph HartC 1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart @d.healey
        last edited by

        @d-healey nice catch. I think the solution is to set a flag whenever you call the uninstall function and then check in the Expansion‘s destructor whether that flag was set and skip the Expansion xml file creation.

        Christoph HartC 1 Reply Last reply Reply Quote 0
        • Christoph HartC
          Christoph Hart @Christoph Hart
          last edited by

          How do you uninstall the expansions?

          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @Christoph Hart
            last edited by

            @Christoph-Hart https://github.com/davidhealey/HiseDownloadManagerToolkit/blob/master/Expansions.js#L372

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            Christoph HartC 1 Reply Last reply Reply Quote 0
            • Christoph HartC
              Christoph Hart @d.healey
              last edited by

              @d-healey Ah OK, so inside Expansion.unloadExpansion() would be the most reasonable place to set this flag, right?

              d.healeyD 1 Reply Last reply Reply Quote 0
              • d.healeyD
                d.healey @Christoph Hart
                last edited by

                @Christoph-Hart Sounds reasonable to me

                Libre Wave - Freedom respecting instruments and effects
                My Patreon - HISE tutorials
                YouTube Channel - Public HISE tutorials

                1 Reply Last reply Reply Quote 0
                • d.healeyD
                  d.healey
                  last edited by

                  Is there ever a reason to create the expansion xml automatically in the destructor?

                  Libre Wave - Freedom respecting instruments and effects
                  My Patreon - HISE tutorials
                  YouTube Channel - Public HISE tutorials

                  1 Reply Last reply Reply Quote 0
                  • d.healeyD
                    d.healey
                    last edited by

                    Ok I added the flag and it works! But I realised there is another scenario we haven't considered.

                    What about when the user has HISE running and then goes into their OS file browser and deletes the expansion files. The xml will still be recreated by the destructor.

                    Libre Wave - Freedom respecting instruments and effects
                    My Patreon - HISE tutorials
                    YouTube Channel - Public HISE tutorials

                    1 Reply Last reply Reply Quote 0
                    • d.healeyD
                      d.healey
                      last edited by

                      @Christoph-Hart Any suggestions?

                      Libre Wave - Freedom respecting instruments and effects
                      My Patreon - HISE tutorials
                      YouTube Channel - Public HISE tutorials

                      Christoph HartC 1 Reply Last reply Reply Quote 0
                      • Christoph HartC
                        Christoph Hart @d.healey
                        last edited by

                        I think it should be safe to assume that if the directory doesn't exist, it shouldn't write that data to the file so this would handle this case too.

                        d.healeyD 1 Reply Last reply Reply Quote 0
                        • d.healeyD
                          d.healey @Christoph Hart
                          last edited by d.healey

                          @Christoph-Hart The problem is that if the directory does exist but the content is removed (as in my video) the files are recreated.

                          We need to make sure the files are never recreated by the compiled project I think, unless you know a reason why they should be.

                          I guess it would also be good to also not create the files if the directory exists but is empty, that would prevent it happening when running in HISE.

                          Libre Wave - Freedom respecting instruments and effects
                          My Patreon - HISE tutorials
                          YouTube Channel - Public HISE tutorials

                          1 Reply Last reply Reply Quote 0
                          • d.healeyD
                            d.healey
                            last edited by d.healey

                            I think I've found a suitable solution, can you see any issues with it?

                            ~Expansion()
                            {
                                if (root.isDirectory() && root.getNumberOfChildFiles(File::TypesOfFileToFind::findFiles, "expansion_info.xml") > 0)
                                    saveExpansionInfoFile();
                            }
                            

                            Libre Wave - Freedom respecting instruments and effects
                            My Patreon - HISE tutorials
                            YouTube Channel - Public HISE tutorials

                            d.healeyD 1 Reply Last reply Reply Quote 0
                            • d.healeyD
                              d.healey @d.healey
                              last edited by

                              @Christoph-Hart This solution good for a pull request?

                              Libre Wave - Freedom respecting instruments and effects
                              My Patreon - HISE tutorials
                              YouTube Channel - Public HISE tutorials

                              Christoph HartC 1 Reply Last reply Reply Quote 0
                              • Christoph HartC
                                Christoph Hart @d.healey
                                last edited by

                                Instead of

                                root.getNumberOfChildFiles(File::TypesOfFileToFind::findFiles, "expansion_info.xml") > 0
                                

                                you can just write

                                root.getChildFile("expansion_info.xml").existsAsFile()
                                

                                this will prevent iterating over the entire directory with the same outcome.

                                d.healeyD 1 Reply Last reply Reply Quote 1
                                • d.healeyD
                                  d.healey @Christoph Hart
                                  last edited by

                                  @Christoph-Hart Ah nice, ok. I'll make that change and create a pull request. Thanks for your help!

                                  Libre Wave - Freedom respecting instruments and effects
                                  My Patreon - HISE tutorials
                                  YouTube Channel - Public HISE tutorials

                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post

                                  14

                                  Online

                                  1.7k

                                  Users

                                  11.8k

                                  Topics

                                  102.6k

                                  Posts