No internet connection
  1. Home
  2. How to

How To Get Finder Home Folder Path

By Matt Friedman @Matt_Friedman
    2024-11-15 18:08:34.258Z

    Is there a programmatic way to get the home folder path?

    I'm using sf.app.proTools.importSessionData and one of its arguments trackDataPresetPath requires the full path to a pro tools track import data preset, ie:

    "/Users/mymac/Documents/Pro Tools/Pro Tools Presets/Track Data to Import/My Setting.ptpreset
    

    This works great on my 1 computer, but obv. won't on my others which have different home folder names.

    Is there a way to get the path to the home folder of the current system?

    • 9 replies
    1. M
      Matt Friedman @Matt_Friedman
        2024-11-15 18:16:23.929Z

        I tried using this and it seems to work!

        sf.appleScript.finder.home.path.toString()
        
        1. In reply toMatt_Friedman:
          Kitch Membery @Kitch2024-11-15 18:33:50.951Z2024-11-15 19:06:54.924Z

          Hi @Matt_Friedman,

          Try this...

          "~/Documents/Pro Tools/Pro Tools Presets/Track Data to Import/My Setting.ptpreset"
          

          Let me know if that works for you. :-)

          1. MMatt Friedman @Matt_Friedman
              2024-11-15 19:05:29.202Z

              I did try the tilde initially but it didn’t work. Maybe that’s a terminal thing??

              1. Kitch Membery @Kitch2024-11-15 19:10:20.897Z

                Hi @Matt_Friedman,

                I just noticed that I missed the closing quotation mark...

                The tilde should work.

                1. In reply toMatt_Friedman:
                  Kitch Membery @Kitch2024-11-15 19:12:40.531Z

                  Example...

                  sf.file.open({ path: "~/Documents/" });
                  
                  1. MMatt Friedman @Matt_Friedman
                      2024-11-15 19:20:49.434Z

                      I think the problem is that the path is used by the pro tools SDK and I think that’s what’s rejecting the tilde.

                      1. Kitch Membery @Kitch2024-11-15 19:56:34.799Z

                        Ahh, I see... Thanks for clarifying... Out of interest, what was the piece of code you were passing the path into? I assume it was the sf.app.proTools.importSessionData method?

                        Thanks in advance.

                        1. MMatt Friedman @Matt_Friedman
                            2024-11-15 20:02:23.118Z
                            const homePath = sf.appleScript.finder.home.path.toString();
                            
                            function importSession(importFile) {
                                sf.app.proTools.importSessionData({
                                    audioHandleSize: 1000,
                                    adjustSessionStartTimeToMatchSource: false,
                                    audioMediaOptions: "LinkToSourceAudio",
                                    importClipGain: true,
                                    importClipsAndMedia: true,
                                    importVolumeAutomation: false,
                                    playlistOptions: "ImportReplaceExistingPlaylists",
                                    sessionPath: importFile,
                                    timecodeMappingStartTime: "00:00:00:00",
                                    timecodeMappingUnits: "MaintainAbsoluteTimeCodeValues",
                                    trackDataPresetPath: homePath + "Documents/Pro Tools/Pro Tools Presets/Track Data to Import/Audio Only.ptpreset",
                                    trackMatchOptions: "MatchTracks",
                                    videoMediaOptions: "LinkToSourceVideo",
                                })
                            }
                            
                            
                            1. Kitch Membery @Kitch2024-11-15 20:08:52.478Z

                              Perfect! Thanks. :-)