Open S1D1T1 opened 2 months ago
piggybacking with issue of .DS_Store being shown- more robust directory listing to ignore the file would be Scripts.swift#L22-L28
var scripts = ((try? FileManager.default.contentsOfDirectory(at: scriptsUrl, includingPropertiesForKeys:[], options:.skipsHiddenFiles)) ?? [])
this causes a downstream format change, requiring a few other code changes.
the 1-line fix is to keep existing code, and filter filenames beginning with '.'
Hi, thanks. I am not sure FSEventStream sandbox policy, do you know a bit more details about this?
my sample app is signed, sandboxed, no entitlements set, it was able to monitor the folder. OS didn't prompt for user permission, since it only looked in the sandbox. I can't completely test with DT's environment, but it should be parallel. the sample app monitors the folder, ~/Library/Containers/DTTestbed/Data/Documents/Scripts
.
Attached code for dynamically updating list of scripts, and demo app. not a PR - I don't have a specific change for DT's startup -that code isn't in the repo.
ScriptsFolderMonitor.swift
: source file with new class,ScriptsFolderMonitor
. Add to project, or append it to Scripts.swift. ScriptsFolderMonitor class watches for changes in Scripts folder and triggers refresh ofScripts.availableScripts
when they occurDTTestbed.swift
: demo use ofScriptsFolderMonitor
class - creates the object at startup, ScriptsFolderMonitor.zip