Re: Detecting if /Network/Library is available
Re: Detecting if /Network/Library is available
- Subject: Re: Detecting if /Network/Library is available
- From: Sandor Szatmari <email@hidden>
- Date: Mon, 03 Sep 2018 14:51:41 -0400
Thanks for your thoughts!
Below vvv
> On Sep 3, 2018, at 13:14, Jean-Daniel <email@hidden> wrote:
>
>
>
>> Le 3 sept. 2018 à 19:07, Sandor Szatmari <email@hidden> a
>> écrit :
>>
>> I have a problem to solve where it appears I need to detect if
>> /Network/Library is available or not.
>>
>> Basically, I’d like to handle situation where I need to copy items from
>> /Network/Library at times when it’s it’s not yet available but may be
>> available soon… i.e. at boot, or after the Network cycles, etc.
>>
>> There’s a couple of strategies I can think of:
>>
>> Keep failing the copy until it works or a default time out expires
>> Notification of availability (Preferred, but I can’t find a way to do this)
>> Quit and retry later.
>>
>> Any suggestion/guidance anyone can provide on this?
>
> I’m not familiar with /Network/Library, but if this is a standard directory,
> you can wait for it to be created using file system event (I think there is a
> node dispatch source for that), and if this is a mount point, you can use
> disk arbitration framework to get notification.
/Network/Library is a special directory published by OSX server that allows you
to share a common ‘Library’ folder to the clients on your LAN. As an example
of its special behavior, it appears as a directory even when not available.
(It probably is a directory itself). It is created once and does not go away,
like /Volumes. I am trying to detect the presence of files within it or
whether it’ is ‘mounted’. When it’s not available ‘ls -al’ responds with ‘ls:
Host not available’. And when it is available ‘ls -al’ responds with directory
contents as expected. I can use this behavior to implement the keep trying
while failure and not timed out approach.
I have looked at FSEvents and Disk arbitration already and I’m not sure I can
use these as it does seem to have special treatment. I hope I can use one of
them. I tried NSWorkspace (disk mount/in mount notifications) and these didn’t
seem to be triggered.
Sandor
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden