fixes for clients

improve detection of tmp dir, and big `ResourceUtils` cleanup (moving most to new `Os` class)