Revert #2782, "fix expand_path abuse"

PR #2782 introduced some nonzero number of problems with shipping modules, so if #3129 is not to your liking, then please land this PR instead.

Fixing this again means reverting this revert -- it shouldn't be too complicated, though, since all the changes are in modules and meterpreter scripts.

This reverts commit d27264b40257b47b64cd8abf82b0c18369faa2cf, reversing changes made to a93265d5e9b05b1e4e0d495c7e867adaccaf7072.