I’m puzzled.
There is no folder com.apple.Safari in the folder Containers of my Home folder.
set path2plist to (path to home folder as text) & "Library:Containers:"
tell application "Finder"
exists folder path2plist
log result
end tell
set path2plist to path2plist & "com.apple.Safari:"
tell application "Finder"
exists folder path2plist
log result
end tell
The events log is :
tell current application
path to home folder as text
--> "SSD 500:Users:**********:"
end tell
tell application "Finder"
exists folder "SSD 500:Users:**********:Library:Containers:"
--> true
(*true*)
exists folder "SSD 500:Users:**********:Library:Containers:com.apple.Safari:"
--> false
(*false*)
end tell
The only folder with this name is :
“SSD 500:Users:**********:Library:WebKit:com.apple.Safari:”
In the Containers folder, the unique folder related to Safari is :
“SSD 500:Users:**********:Library:Containers:com.apple.Safari.CacheDeleteExtension:”
The default Downloads folder is defined in the entry : DownloadsPath
in the file :
“SSD 500:Users:**********:Library:Preferences:com.apple.Safari.plist”
In the same file, the entry NSNavLastRootDirectory points to the Desktop.
Auxiliary comment, in the UI code there is no need for:
set downloadsFolder to POSIX path of (path to desktop folder)
-- copy the download folder path to the clipboard
set the clipboard to downloadsFolder as text
because downloadsFolder, like every POSIX path IS a string
set downloadsFolder to POSIX path of (path to desktop folder)
-- copy the download folder path to the clipboard
set the clipboard to downloadsFolder
is sufficient.
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) samedi 15 juin 2019 17:39:07