Assuming that you don't care whether it's a ramdisk or not, the method you describe works very reliably and simply on every operating system. There's a lot to be said for that. If you're not sure you can write to it, simply create a sentinel file with any known-to-you name and leave it there.