开发者

Is there a way to save a "." file using NSSavePanel without MacOS warning me?

开发者 https://www.devze.com 2023-03-20 02:09 出处:网络
I\'m working on a cocoa project. My project uses a preferences menu, and includes the option to save a set of preferences as a \".\" file (hidden files like .rvmrc or .vimrc). The problem is that afte

I'm working on a cocoa project. My project uses a preferences menu, and includes the option to save a set of preferences as a "." file (hidden files like .rvmrc or .vimrc). The problem is that after bringing up the NSSavePanel 开发者_运维技巧and clicking Save the system pops up and reminds me that "." is reserved for the system, which isn't very cool.

Is there some way to prevent the OS from firing that prompt?

Thanks!


You can subclass or make a category of NSSavePanel and override

-[NSSavePanel _legalNameCheck:]

AFAIK, checking for the dot name is all that routine does.

0

精彩评论

暂无评论...
验证码 换一张
取 消