use os tmp directory and isolate windows specific code