diff options
Diffstat (limited to 'examples/consumer')
-rw-r--r-- | examples/consumer/common.php | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/examples/consumer/common.php b/examples/consumer/common.php index 67f4273..fddc1c3 100644 --- a/examples/consumer/common.php +++ b/examples/consumer/common.php @@ -50,7 +50,25 @@ function &getStore() { * created elsewhere. After you're done playing with the example * script, you'll have to remove this directory manually. */ - $store_path = "/tmp/_php_consumer_test"; + $store_path = null; + if (function_exists('sys_get_temp_dir')) { + $store_path = sys_get_temp_dir(); + } + else { + if (strpos(PHP_OS, 'WIN') === 0) { + $store_path = $_ENV['TMP']; + if (!isset($store_path)) { + $dir = 'C:\Windows\Temp'; + } + } + else { + $store_path = @$_ENV['TMPDIR']; + if (!isset($store_path)) { + $store_path = '/tmp'; + } + } + } + $store_path .= DIRECTORY_SEPARATOR . '_php_consumer_test'; if (!file_exists($store_path) && !mkdir($store_path)) { |