What I would understand if I were reviewing the code is that on Windows /tmp not necessarily the best place to create a temporary directory, as well as the original argument '', it may not be obvious for a casual consideration that it creates <nothing>/tmp/abc . Therefore, I would recommend this code:
File.join(Dir.tmpdir(), 'abc')
See Ruby-doc for an explanation .
UPDATE
If we break down the problem into a more general solution that is not related to using tmpdir() , I don't see the round path using the initial idiom (hack?). On Linux, this is not a big deal, maybe, but on Windows with a few drive letters it will. In addition, there is no Ruby or gem API to iterate mount points.
Therefore, my recommendation was to delegate the mount point definition to a configuration parameter, which could be '/' for Linux, 'z:/' for Windows, and smb://domain; user@my.file.server.com /mountpoint smb://domain; user@my.file.server.com /mountpoint for the Samba share, then use File.join(ProjectConfig::MOUNT_POINT, 'some', 'where', 'abc') .
source share