HISE Logo Forum
    • Categories
    • Register
    • Login

    Add File object from absolute path string

    Scheduled Pinned Locked Moved Feature Requests
    11 Posts 4 Posters 567 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.
    • ustkU
      ustk @d.healey
      last edited by

      @d-healey Well, I'm trying for hours...

      You can make a user selecting a custom directory for anything you want,
      for instance "/Users/greg/Documents/myAwesomeLocation" just for the sake of the example

      Then you can dump it let say in a pref file as an object parameter
      Then at the next init when you recall the pref file, it is (at least for me) impossible to recreate the File object from this path string.
      Well I say impossible but I found a way, but it's a bit dirty...
      I split the path into substrings and recursively get the next childFile. But this means I need to begin somewhere I'm not really sure of. like root disk, and then add Users, then Documents, you get it...
      If the user selects another directory that is not on the root disk, I have no proper way to know, and recall isn't possible.

      Since JUCE already can create File from an absolute path with File::File (const String & absolutePath)
      I'm trying to just implement it but with no success for now...

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

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

        Why not FileSystem.getFolder(FileSystem.Documents).getChildFile(myAwesomeLocation) ?

        The problem is that absolute paths do not translate well across different operating systems so if you can achieve what you want with relative paths, it should be more robust.

        ustkU 2 Replies Last reply Reply Quote 0
        • ustkU
          ustk @Christoph Hart
          last edited by

          @Christoph-Hart Well Documents was just an example, the user can choose whatever he wants and I have no ways to know...

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

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

            Then use the FileSystem.browse method?

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

              @Christoph-Hart The fact is that I don't fix the path myself so cross-compatibility isn't an issue here. It is the user who just set his path preferences, he won't copy the pref file to another computer...

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

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

                @Christoph-Hart said in Add File object from absolute path string:

                Then use the FileSystem.browse method?

                This is what I do to get the path, but in order to dump it in a pref file I need to get the full path with toString(0)

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

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

                  This is what I do for now...

                  HiseSnippet 1190.3ocuWstaaaCElxIZnVadXEnX+lv+RFMyw1qsaXYAMw2VM1hsQTR6FVGJTjnsIhLo.IURMJx611ixdC1av1g5hkRhSlqGxT9SN2+34bHOGOVv8HRIWfLJexhPBx3yLcVvTy5LykxPC5hLdhYWpf3o3BJQdBQpnron1KBckRhOxvXqePqoQ4sQwe+0Ka6F3x7H4rPnWyodjehNmpx4N9fejFDz20mbBcdAse1AC73rN7.dDfpsLafBc8N2cJYnqVsRlHiOomOEviixUQjHisay8W3LieIKQ+WSkzyBHZhlHGvQIr6yC70HVyE0YFMveb1oWh.uLNOWrURt3IlGQ8oK4mmS9hXA3bKJlOLJcevqYQ30X8gmQA3scB7droimfFpxknw1mZNfoHhItPInHrRzEU5OMM6vAMXp5ycOmzW.DKsv9EMZrC94MZTauJVUrfBgTguvUfG4f2G2iMkxH0mRTibruoF9T44YcJK.k6SCHNKjJxbsAwmNgcAlmJIhWwmSpoEO1U..Zo41qlYbD0wBxqodbuDFxnyF6plISIAKz3RD4oH9KcPr4Ur1cWbaA+RIAOgqgcpzJVTV.b7vShXdJJmg4r1QJEm0TmuD7.aO97PNCvzNvINHhTqh0GpXggO5DrcFKMcJa8Wgi7YwgsOWjelJH8vvvttJ2cVB.aAQFEnpk6qBtU+kmFf7chx6kqwU0JPj+eqN2.N3ZEv8vPZRRTXpBOgJfZrhiEbtB6KnWPRb2UUrtBhQV6DTx5jkgrqll6pVqtTyONC1wMH3L31r8MSs0RqMwUmiIdBBb2YcpMs9OUahacHgtBWHJPJv95c3382GW8MCFVsF9k3pu8sUweGt5tUArVN2GYsdf440i5JtiR.uTZ2.N+gATk8x3jUVxcgtOzltey8vzuOyc0CHropY.qm9z6tC.N8Rd.odHDKHDo19qzea0096s9uZAwUU8qQ5N06JBWs9MZ0kvKg1YFuFcPst+NnV2pC5+q+JzKNjqHiX10r9fUYqqrv2TzjIqTVJzCfGFWkX8bQw8YnMKZ9YDQVGelhv.hqOAx7tm.Ub.oWRUnfhb1.FUMJjvtq4RnzRGLgpTJp.UUwym97z4SIEJDEFCU1L8dOJFxE2Q.8QXdqUX9oCzudpmTlBI.lgDghpy.FcIW.qfjL2rrYWh7bEOLFyosaHiGsFn98KC4uO4fE4w+WN3RpuZFjpM9CfbFgNclRS0EnTj2qcuY6iG8FmdHp7HXrGS4J.GXTB8QAgV2IDB92gvWZdbuNiF5bxwm14D7gC6hcd0n2bK.c6MMf8c39QA5WuJtDjdyuTAPe4011PuQASRUKJtY3CxlQqKber4Xpxa1pwaoUfWcK8CLdS2yrhYuISfmGyA61l8+4G9kJQGyizqyejKLqB5qLGFM2AV61i.HgwHA52NfFBsowzMzz5LiCg4GS72vWpvlZZiTgMyDhl65I3uyK4xsdS1GEyAvDKdg9xlGoowKeRvzrQ8Fn4vB1uyySmJ9J.6q1lVafMe8FXyy1.ad9FXyK1.a9lMvlu8dsQ+aaNLRwmmbMAXLtW7aqFF8XtPWVbGI5e.DUPa+D
                  

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

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

                    I get the problem now.
                    Why not dump it to the appData folder instead of asking the user where they want it?

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

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

                      @d-healey In fact it is for a customizable VST folder, so the user decides... Thus, the absolute path ;)

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

                      Oli UllmannO 1 Reply Last reply Reply Quote 0
                      • Oli UllmannO
                        Oli Ullmann @ustk
                        last edited by

                        @ustk
                        Is that still the way you do it or have you found a nicer solution in the meantime? I'm facing the same problem... :-)

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

                        53

                        Online

                        1.7k

                        Users

                        11.7k

                        Topics

                        101.8k

                        Posts