Is there a reliable, cross-platform (on *nix anyway) way to create a temporary file on another device?

I’m trying to write a test case for some code that should iterates over a filesystem tree, but should stop if a file is on another device. In writing tests for it, I considered creating a file in /dev/shm, symlinking to it from my test directory, and then checking that it isn’t read, but /dev/shm seems to be Linux-specific. mount-ing a tmpfs could be an option, but it requires root…

Any ideas how this can be accomplished?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s