Use Post::File methods when possible. They try to be multiplatform and multisession. The expand_path method looks good to be used here.