문제

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