File.expand_path fails

Hi There,

The following line fails when I try to execute it with a user what has
no home directory set. I use the www-data user in a web browser and I
cannot make it work - the command get sucked with ruby 2.3.0, no raise,
nothing, just execution stops and the scrip returns error code 2.

File.expand_path("~/x.txt");

The tilde character comes from a framework so I cannot change that one.
Is there any way to get it working at all?

Thanks,
Sandor

To what would you like the ~ to expand to?