summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorVern Sun <s5unty@gmail.com>2015-06-17 11:23:27 +0800
committerhut <hut@lepus.uberspace.de>2015-06-19 20:32:24 +0200
commit4da0355a0e1d7bdc58a4df03409c142c5a0a6b88 (patch)
tree7f7bdf99c4abeace399a0c4cbb2fe486f03ae90f
parent864e372ce78c6e2c027bf525ea9eae1dfd0ddb0a (diff)
downloadranger-4da0355a0e1d7bdc58a4df03409c142c5a0a6b88.tar.gz
honour the TMPDIR environment variable
-rw-r--r--ranger/__init__.py3
-rw-r--r--ranger/core/main.py5
2 files changed, 5 insertions, 3 deletions
diff --git a/ranger/__init__.py b/ranger/__init__.py
index e20f55d8..8a1e7459 100644
--- a/ranger/__init__.py
+++ b/ranger/__init__.py
@@ -10,6 +10,7 @@ program you want to use to open your files with.
 
 import sys
 import os
+import tempfile
 
 # Information
 __license__ = 'GPL3'
@@ -24,7 +25,7 @@ TIME_BEFORE_FILE_BECOMES_GARBAGE = 1200
 MAX_RESTORABLE_TABS = 3
 MACRO_DELIMITER = '%'
 DEFAULT_PAGER = 'less'
-LOGFILE = '/tmp/ranger_errorlog'
+LOGFILE = tempfile.gettempdir()+'/ranger_errorlog'
 CACHEDIR = os.path.expanduser("~/.cache/ranger")
 USAGE = '%prog [options] [path]'
 VERSION = 'ranger-master %s\n\nPython %s' % (__version__, sys.version)
diff --git a/ranger/core/main.py b/ranger/core/main.py
index 524a9a19..55102dc2 100644
--- a/ranger/core/main.py
+++ b/ranger/core/main.py
@@ -5,6 +5,7 @@
 
 import os.path
 import sys
+import tempfile
 
 def main():
     """initialize objects and run the filemanager"""
@@ -133,8 +134,8 @@ def main():
             import pstats
             profile = None
             ranger.__fm = fm
-            cProfile.run('ranger.__fm.loop()', '/tmp/ranger_profile')
-            profile = pstats.Stats('/tmp/ranger_profile', stream=sys.stderr)
+            cProfile.run('ranger.__fm.loop()', tempfile.gettempdir()+'/ranger_profile')
+            profile = pstats.Stats(tempfile.gettempdir()+'/ranger_profile', stream=sys.stderr)
         else:
             fm.loop()
     except Exception: