Issue #298: Fix onefile mode with stb.h functions.
Issue #298: Check temppath existence only once.
Issue #298: Consolidate multiple implementation of get_thisfile() to one function.
Issue #298: Fix compilation on Windows.