Is it possible to write a system extension that redirect a file on file system to another place?

I want make a system extension which redirect a file to another one.

For example, whatever you do with path `/path/to/fileA`, it actually operate on `/another_path/to/fileB`.

It's not a symbol link, `/path/to/fileA` even does not exists.

Is it possible to write a system extension that redirect a file on file system to another place?

No. It may be possible via other means, but it’s hard to say without knowing more about your requirements. Why do you want to do this?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I want make a tool to prevent `.DS_Store` creation. Redirect all `.DS_Store` files to a directory that nobody cares. I already achieved this by injecting a dylib to `DesktopServicesPriv.framework` and hook some syscall. It works but I must diable SIP. I am wandering if I can do this with SIP enabled.

Redirecting writes is a challenge. Have you tried simply denying the creation of these files? Last I checked, the Finder does not chuck a wobbly if creating a

.DS_Store
file fails.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

"does not chuck a wobbly" is worth my annual Apple Developer cost by itself. Thank you Quinn!

I already achieved redirecting writes. I just want to know if I can do this with SIP enabled

I already achieved redirecting writes. I just want to know if I can do this with SIP enabled

That depends on how you did this. If you’re using the technique you described in your 9 Dec post — injecting code into an Apple process — such shenanigans are not supported and it’s not coincidence that they are blocked by SIP.

OTOH, if you’ve found some other technique, feel free to share the details and we can take things from there.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Is it possible to write a system extension that redirect a file on file system to another place?
 
 
Q