Permission problem

Hi,

I just tried to remove the .build folder and I got this error:

Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission."

But I'm the administrator of my computer and yes, I tried to remove it "as administrator"

Plus... Cocoa? I'm on Windows... :confused:

Windows 11
Swift 5.9.2

Any idea?

It could be that something is holding on to the directory. You may have it open in explorer, in a terminal, or perhaps an editor?

Thank you Saleem for your reply.

Yes I double checked if any process was blocking access, as any windows user painfully learnt to do :slight_smile:
I use one of the tools in windows very own power toys. However the tool couldn't find anything.
Obviously a process was holding those files though, because after a full reboot, I was able to delete the folder.

This is not the first time I encounter that issue, so I was hoping it was something common and that maybe a simple fix was known.

Not necessarily - it could have been a zombie lock. The process could have terminated without relinquishing a lock, the kernel could have inherited it. The way to get around deletion is to use something like:

MoveFileExW(pwszFile, L"NUL", MOVEFILE_DELAY_UNTIL_REBOOT);

This allows for deleting the file on the next reboot.

1 Like