HISE Logo Forum
    • Categories
    • Register
    • Login

    FileSystem - wheres "CreateFile"?

    Scheduled Pinned Locked Moved General Questions
    16 Posts 6 Posters 638 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 @Lindon
      last edited by

      @Lindon I think there is a function called something like writeEncryptedObject might be what you need.

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

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

        @d-healey said in FileSystem - wheres "CreateFile"?:

        @Lindon I think there is a function called something like writeEncryptedObject might be what you need.

        nope that requires I already have the file in question:

        File.writeEncryptedObject(var jsonData, String key)

        HISE Development for hire.
        www.channelrobot.com

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

          Are you sure? I think it should be possible.

          1 Reply Last reply Reply Quote 0
          • ustkU
            ustk @Lindon
            last edited by

            @Lindon AFAIR the file is automatically created...

            Can't help pressing F5 in the forum...

            LindonL 1 Reply Last reply Reply Quote 0
            • LindonL
              Lindon @ustk
              last edited by Lindon

              @ustk @Christoph-Hart

              OK can either of you give me an example? I have this JSON:

              const var p =
                      {
                          "id": "myID",
                          "password": "something"
                      };
              
              

              how do I encode this in a file ?

              • to be precise - in a file that currently does not exist...

              HISE Development for hire.
              www.channelrobot.com

              Casey KolbC 1 Reply Last reply Reply Quote 0
              • Casey KolbC
                Casey Kolb @Lindon
                last edited by

                @Lindon It's what David said writeEncryptedObject

                You just need a File object in HISE in which to store it. That doesn't mean the file already has to exist.

                Casey Kolb
                Founder & CEO of Lunacy Audio
                Composer | Producer | Software Developer

                Casey KolbC 1 Reply Last reply Reply Quote 1
                • Casey KolbC
                  Casey Kolb @Casey Kolb
                  last edited by

                  Try something like this:

                  const var p =
                          {
                              "id": "myID",
                              "password": "something"
                          };
                  local machineId = FileSystem.getSystemId();
                  local dir = FileSystem.getFolder(FileSystem.AppData);
                  dir.getChildFile("license.dat").writeEncryptedObject(p, machineId);
                  

                  Casey Kolb
                  Founder & CEO of Lunacy Audio
                  Composer | Producer | Software Developer

                  LindonL 1 Reply Last reply Reply Quote 0
                  • ?
                    A Former User
                    last edited by

                    @Lindon
                    Are you using Woocommerce REST API for customer login?
                    Which REST API method do you suggest for this (verifying purchases, license status...etc)?

                    LindonL 1 Reply Last reply Reply Quote 0
                    • LindonL
                      Lindon @Casey Kolb
                      last edited by

                      @Lunacy-Audio said in FileSystem - wheres "CreateFile"?:

                      const var p =
                      {
                      "id": "myID",
                      "password": "something"
                      };
                      local machineId = FileSystem.getSystemId();
                      local dir = FileSystem.getFolder(FileSystem.AppData);
                      dir.getChildFile("license.dat").writeEncryptedObject(p, machineId);

                      OK thanks - now we are back at this AppData shenanigans, which I was hoping to avoid...

                      HISE Development for hire.
                      www.channelrobot.com

                      d.healeyD 1 Reply Last reply Reply Quote 0
                      • LindonL
                        Lindon @A Former User
                        last edited by Lindon

                        @Steve-Mohican said in FileSystem - wheres "CreateFile"?:

                        @Lindon
                        Are you using Woocommerce REST API for customer login?
                        Which REST API method do you suggest for this (verifying purchases, license status...etc)?

                        No I am using a custom built api that checks users subscription levels and which plug-ins they have access to.

                        HISE Development for hire.
                        www.channelrobot.com

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

                          @Lindon I think appData was just an example, use a different folder if you want to.

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

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

                            @d-healey said in FileSystem - wheres "CreateFile"?:

                            @Lindon I think appData was just an example, use a different folder if you want to.

                            I didnt mean literally just "AppData" - its any folder in the file system - its a lot less friendly than the loadAsJSON, saveAsJSON, which puts the file in the {PROJECT FOLDER} when I'm in development and using HISE, and puts it in the projects own folder when its compiled...

                            Where as the File System insists upon using (for example) the AppData folder all the time, elsewhere I've asked why we cant have :

                            local dir = FileSystem.getFolder(FileSystem.ProjectFolder);

                            as clearly there's a mechanism at play that can resolve this in development and at run time...

                            HISE Development for hire.
                            www.channelrobot.com

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

                              @Lindon said in FileSystem - wheres "CreateFile"?:

                              local dir = FileSystem.getFolder(FileSystem.ProjectFolder);

                              And this folder is pointing to what in a compiled plugin?

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

                                @Christoph-Hart pointing to AppData

                                HISE Development for hire.
                                www.channelrobot.com

                                Casey KolbC 1 Reply Last reply Reply Quote 0
                                • Casey KolbC
                                  Casey Kolb @Lindon
                                  last edited by

                                  @Lindon I haven't had any issues using the AppData folder both for development in HISE and in the compiled plugin. It's actually nice because you don't have two sets of the same files. For example, in my code I create and store a custom settings file in the AppData folder, so when I'm developing in HISE it just writes to the same file as the compiled plugin, which is totally fine.

                                  Is there a specific use-case you want for saving things to the Project Folder instead of the AppData folder?

                                  Casey Kolb
                                  Founder & CEO of Lunacy Audio
                                  Composer | Producer | Software Developer

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

                                  14

                                  Online

                                  1.7k

                                  Users

                                  11.8k

                                  Topics

                                  103.2k

                                  Posts