string GetTargetDirectory(string fname) { return Permissions.WithDiscoveryPermission(() => Path.GetDirectoryName(Path.GetFullPath(fname))); }