Forum
    • Categories
    • Register
    • Login

    [bug] Encrypted expansions magically turning into file based

    Scheduled Pinned Locked Moved Bug Reports
    expansionencryptedfile based
    16 Posts 2 Posters 1.3k 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.
    • David HealeyD
      David Healey
      last edited by David 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

      Free HISE Bootcamp Full Course for beginners.
      YouTube Channel - Public HISE tutorials
      My Patreon - HISE tutorials

      Christoph HartC 1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart @David 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?

          David HealeyD 1 Reply Last reply Reply Quote 0
          • David HealeyD
            David Healey @Christoph Hart
            last edited by

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

            Free HISE Bootcamp Full Course for beginners.
            YouTube Channel - Public HISE tutorials
            My Patreon - HISE tutorials

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

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

              David HealeyD 1 Reply Last reply Reply Quote 0
              • David HealeyD
                David Healey @Christoph Hart
                last edited by

                @Christoph-Hart Sounds reasonable to me

                Free HISE Bootcamp Full Course for beginners.
                YouTube Channel - Public HISE tutorials
                My Patreon - HISE tutorials

                1 Reply Last reply Reply Quote 0
                • David HealeyD
                  David Healey
                  last edited by

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

                  Free HISE Bootcamp Full Course for beginners.
                  YouTube Channel - Public HISE tutorials
                  My Patreon - HISE tutorials

                  1 Reply Last reply Reply Quote 0
                  • David HealeyD
                    David 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.

                    Free HISE Bootcamp Full Course for beginners.
                    YouTube Channel - Public HISE tutorials
                    My Patreon - HISE tutorials

                    1 Reply Last reply Reply Quote 0
                    • David HealeyD
                      David Healey
                      last edited by

                      @Christoph-Hart Any suggestions?

                      Free HISE Bootcamp Full Course for beginners.
                      YouTube Channel - Public HISE tutorials
                      My Patreon - HISE tutorials

                      Christoph HartC 1 Reply Last reply Reply Quote 0
                      • Christoph HartC
                        Christoph Hart @David 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.

                        David HealeyD 1 Reply Last reply Reply Quote 0
                        • David HealeyD
                          David Healey @Christoph Hart
                          last edited by David 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.

                          Free HISE Bootcamp Full Course for beginners.
                          YouTube Channel - Public HISE tutorials
                          My Patreon - HISE tutorials

                          1 Reply Last reply Reply Quote 0
                          • David HealeyD
                            David Healey
                            last edited by David 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();
                            }
                            

                            Free HISE Bootcamp Full Course for beginners.
                            YouTube Channel - Public HISE tutorials
                            My Patreon - HISE tutorials

                            David HealeyD 1 Reply Last reply Reply Quote 0
                            • David HealeyD
                              David Healey @David Healey
                              last edited by

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

                              Free HISE Bootcamp Full Course for beginners.
                              YouTube Channel - Public HISE tutorials
                              My Patreon - HISE tutorials

                              Christoph HartC 1 Reply Last reply Reply Quote 0
                              • Christoph HartC
                                Christoph Hart @David 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.

                                David HealeyD 1 Reply Last reply Reply Quote 1
                                • David HealeyD
                                  David 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!

                                  Free HISE Bootcamp Full Course for beginners.
                                  YouTube Channel - Public HISE tutorials
                                  My Patreon - HISE tutorials

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

                                  35

                                  Online

                                  2.1k

                                  Users

                                  13.0k

                                  Topics

                                  113.1k

                                  Posts