I'm using a Mac. I need to rename a file in the /Library/Application Support/AppName/filename.aiff

This is the system library and not /User/username/Library...

I'm using the rename(old name, new name) function. This function doesn't work (even though it doesn't return an error) if I place the file in the /Library/Application Support/AppName directory but it works properly if I place the file, for example, in /User/username/Documents/filename.aiff.

I don't know what the problem is. Any help would be appreciated. Thanks!

有帮助吗?

解决方案

You don't own the directory you're trying to move files into:

  • /Users/Username/... is a user owned directory, so you're allowed to manipulate files there.

  • /Library is not a user owned directory.

In order to manipulate files in a non-user owned directory you would need elevated permissions. Instead of using /Library you should be using ~/Library, which is the user owned directory. ~/Library is the shorthand name for /Users/Username/Library.

其他提示

If the rename is working fine in other path means the problem should be related to permission to access file or with the path searched for file.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top