Forum
    • Categories
    • Register
    • Login

    Copy File API

    Scheduled Pinned Locked Moved General Questions
    13 Posts 5 Posters 585 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 @DanH
      last edited by David Healey

      @DanH Are you sure that LicenseFile exists? I haven't checked but it could be that the target has to be a file not a directory:

      LicenseFile.copy(FileSystem.getFolder(FileSystem.AppData).getChildFile("MyLicense.txt"));

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

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

        @d-healey aha that was it, thanks!

        DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
        https://dhplugins.com/ | https://dcbreaks.com/
        London, UK

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

          @DanH said in Copy File API:

          @d-healey aha that was it, thanks!

          What was?

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

          Christoph HartC DanHD 2 Replies Last reply Reply Quote 0
          • Christoph HartC
            Christoph Hart @David Healey
            last edited by

            @d-healey If you copy a file somewhere you must ensure that the parent directory exists or the copy action will fail (because it will never implicitly create directories).

            1 Reply Last reply Reply Quote 1
            • DanHD
              DanH @David Healey
              last edited by

              @d-healey it needed to be written / copied to a file, not a directory :)

              DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
              https://dhplugins.com/ | https://dcbreaks.com/
              London, UK

              1 Reply Last reply Reply Quote 1
              • Dan KorneffD
                Dan Korneff
                last edited by

                Does copy() only work for specific types of files? I'm trying to copy image files, but it's not working:

                const var sourceFile = FileSystem.getFolder(FileSystem.Desktop).getChildFile("OldImage.jpg");
                sourceFile.copy(FileSystem.getFolder(FileSystem.Downloads).getChildFile("NewImage.jpg"));
                

                but it works with text:

                const var sourceFile = FileSystem.getFolder(FileSystem.Desktop).getChildFile("OldText.txt");
                sourceFile.copy(FileSystem.getFolder(FileSystem.Downloads).getChildFile("NewText.txt"));
                

                If so, how can I copy images to new locations?

                Dan Korneff - Producer / Mixer / Audio Nerd

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

                  @Dan-Korneff I just tested and this works for me

                  const source = FileSystem.getFolder(FileSystem.UserHome).getChildFile("original.png");
                  const target = FileSystem.getFolder(FileSystem.Desktop).getChildFile("test.png");
                  
                  source.copy(target);
                  

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

                  Dan KorneffD 1 Reply Last reply Reply Quote 0
                  • Dan KorneffD
                    Dan Korneff @David Healey
                    last edited by

                    @d-healey Thanks for testing! It looks like pilot error. It WAS copying the files... with the original attributes. When I sorted my file browser by date, I was expecting to see the new file at the top.

                    Dan Korneff - Producer / Mixer / Audio Nerd

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

                      @Dan-Korneff said in Copy File API:

                      When I sorted my file browser by date, I was expecting to see the new file at the top.

                      I'm guessing you're on a Mac?

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

                      Dan KorneffD 1 Reply Last reply Reply Quote 0
                      • Dan KorneffD
                        Dan Korneff @David Healey
                        last edited by

                        @d-healey PC

                        Dan Korneff - Producer / Mixer / Audio Nerd

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

                          @Dan-Korneff Oooh I thought it would give fresh meta data on Windows, interesting!

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

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

                            @d-healey said in Copy File API:

                            @Dan-Korneff Oooh I thought it would give fresh meta data on Windows, interesting!

                            create dates would be the same I think - date modified should be different on Windows

                            HISE Development for hire.
                            www.channelrobot.com

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

                            28

                            Online

                            2.1k

                            Users

                            13.0k

                            Topics

                            112.6k

                            Posts