一部の WebDAV および SMB 共有をプログラムでマウントしようとしていますが、ボリュームにデフォルト以外の特定の名前を付けたいと考えています。たとえば、マウントすると
Finderに次のように表示したい
/Volumes/My SharePoint Site
または
~/Desktop/My SharePoint Site
それ以外の
/Volumes/grigutis
または
~/Desktop/grigutis
これは、mount_webdav コマンドで実行できます。
$ mkdir /Volumes/My\ SharePoint\ Site
$ mount_webdav -s -i https://my.sharepoint.school.edu/personal/grigutis /Volumes/My\ SharePoint\ Site
or
$ mkdir ~/Desktop/My\ SharePoint\ Site
$ mount_webdav -s -i https://my.sharepoint.school.edu/personal/grigutis ~/Desktop/My\ SharePoint\ Site
しかし、これを NetFSMountURLSync で動作させることはできません (既にディレクトリを作成していると仮定します):
NSURL *url = [NSURL URLWithString:@"https://my.sharepoint.school.edu/personal/grigutis"];
NSURL *mountpath = [NSURL fileURLWithPath:@"/Volumes/My SharePoint Site" isDirectory:YES];
or
NSURL *mountpath = [NSURL fileURLWithPath:[@"~/Desktop/My SharePoint Site" stringByExpandingTildeInPath] isDirectory:YES];
CFArrayRef mountpoints = NULL;
int result = 0;
result = NetFSMountURLSync((__bridge CFURLRef)url,
(__bridge CFURLRef)mountpath,
CFSTR("Kerberos"),
CFSTR("NoPassword"),
NULL,
NULL,
&mountpoints);
/Volumes/My SharePoint Site にマウントしようとすると、Finder ダイアログが表示されます。
サーバー「my.sharepoint.school.edu」への接続中に問題が発生しました。このサーバーにアクセスする権限がありません。
関数は結果 13 (許可が拒否されました) を返します。
~/Desktop/My SharePoint Site にマウントしようとすると、このようにマウントされます
~/Desktop/マイ SharePoint サイト/grigutis
これは私が望むものではありません。これについてバグレポートを提出しました。何か案は?可能であれば、NSTask は避けたいと思います。