Added function to add trailing slash to directory paths if necessary,
added 'global' variable for is_windows,
improved logging.